No IP needed in Caddyfile

This commit is contained in:
gitlab.com/pepa65 2022-08-31 16:56:24 +07:00
parent 5ba41cfb5b
commit d043418d88

View File

@ -29,7 +29,7 @@ from https://caddyserver.com/download and place the `caddy` binary in
For php functionality, install `php-fpm` (on deb-based systems: For php functionality, install `php-fpm` (on deb-based systems:
`apt install php-fpm`) and make the config file `/root/Caddyfile` with: `apt install php-fpm`) and make the config file `/root/Caddyfile` with:
``` ```
$ipaddress:80 { :80 {
basicauth { basicauth {
$user $hashpassword $user $hashpassword
} }
@ -38,17 +38,16 @@ $ipaddress:80 {
file_server file_server
} }
``` ```
* Replace `$ipaddress` with the server's IP address. Alternatively, if the * If the server IP has an DNS A record pointing to it, `:80` can be replaced
server has an DNS A record pointing to it, `$ipaddress:80` can be replaced by the domainname with the A record.
by the domainname that the A record lists.
* Replace `$user` with the desired username for authentication. * Replace `$user` with the desired username for authentication.
* Replace `$hashpassword` with the output of `caddy hash-password` which will * Replace `$hashpassword` with the output of `caddy hash-password` which will
ask for the password to be used for authentication. ask for the password to be used for authentication.
* Replace `$repopath` (see above in Install). * Replace `$repopath` (see above in Install).
* The value of `/run/php/php-fpm.sock` might need to be adjusted, depending * The value of `/run/php/php-fpm.sock` might need to be adjusted, depending
on the system used, it needs to be the socket for php. on the system used, it needs to be the unix socket for php.
* Caddy can be started at boottime by including `@reboot /root/Caddy` as a * Caddy can be started at boottime by including `@reboot /root/Caddy` as a
line in root's crontab: `crontab -e` and make the file /root/Caddy` with: line in root's crontab: `crontab -e` and make the file `/root/Caddy` with:
``` ```
#!/usr/bin/env bash #!/usr/bin/env bash