1. Caddy version (caddy version
):
v2.3.0 h1:fnrqJLa3G5vfxcxmOH/+kJOcunPLhSBnjgIvjXV/QTA=
2. How I run Caddy:
a. System environment:
[yves@sd-163808 log]$ cat /etc/os-release
NAME="CentOS Stream"
VERSION="8"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Stream 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_SUPPORT_PRODUCT_VERSION="CentOS Stream"
[yves@sd-163808 log]$
b. Command:
sudo systemctl restart caddy
c. Service/unit/compose file:
I am not using Docker.
[yves@sd-163808 log]$ cat /usr/lib/systemd/system/caddy.service
# caddy.service
#
# For using Caddy with a config file.
#
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
#
# See https://caddyserver.com/docs/install for instructions.
#
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
[Service]
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
[yves@sd-163808 log]$
d. My complete Caddyfile or JSON config:
[yves@sd-163808 tmp]$ sudo cat /etc/caddy/Caddyfile
team-tabulos.com
#log {
# output file /tmp/caddy.log
# level DEBUG
#}
log
root * /tmp/tabulos
#root * /var/tabulos_backup
php_fastcgi unix//run/php-fpm/www.sock
[yves@sd-163808 tmp]$
3. The problem I’m having:
I have a specific problem: when I point root to /var/tabulos_backup, then my site is working (php files get executed and I get their results). If I migrate root to /tmp/tabulos/ it no longer works: instead my brower gets “File not found.” reply. I guess the issue is easy: it is some privilege work to do somewhere… I guess…
So… in order to find out what’s happening, I’m trying to get more log files, in order to investigate this specific issue. To do so, I’ve added the log directive in my config file. Thus I expect to have more log when launching the journal -u caddy
command. And it’s the case, but it’s not really helpful: I am just seeing the 404 error answered back.
So my question is the following: how can I get caddy to be more verbose with its log file so I can get more information on what’s happening with my files not being found out.
PS: I am not a web developer and I do not usually install VPS, web servers and the like. That’s what I am doing right now, and I’m doing it to learn. So the actual problem might be … me , not seeing obvious resolution to my problems.
4. Error messages and/or full log output:
Mar 31 19:36:08 sd-163808 systemd[1]: caddy.service: Succeeded.
Mar 31 19:36:08 sd-163808 systemd[1]: Stopped Caddy.
Mar 31 19:36:08 sd-163808 systemd[1]: Started Caddy.
Mar 31 19:36:08 sd-163808 caddy[103637]: caddy.HomeDir=/var/lib/caddy
Mar 31 19:36:08 sd-163808 caddy[103637]: caddy.AppDataDir=/var/lib/caddy/.local/share/caddy
Mar 31 19:36:08 sd-163808 caddy[103637]: caddy.AppConfigDir=/var/lib/caddy/.config/caddy
Mar 31 19:36:08 sd-163808 caddy[103637]: caddy.ConfigAutosavePath=/var/lib/caddy/.config/caddy/autosave.json
Mar 31 19:36:08 sd-163808 caddy[103637]: caddy.Version=v2.3.0
Mar 31 19:36:08 sd-163808 caddy[103637]: runtime.GOOS=linux
Mar 31 19:36:08 sd-163808 caddy[103637]: runtime.GOARCH=amd64
Mar 31 19:36:08 sd-163808 caddy[103637]: runtime.Compiler=gc
Mar 31 19:36:08 sd-163808 caddy[103637]: runtime.NumCPU=2
Mar 31 19:36:08 sd-163808 caddy[103637]: runtime.GOMAXPROCS=2
Mar 31 19:36:08 sd-163808 caddy[103637]: runtime.Version=go1.14.12
Mar 31 19:36:08 sd-163808 caddy[103637]: os.Getwd=/
Mar 31 19:36:08 sd-163808 caddy[103637]: LANG=en_US.UTF-8
Mar 31 19:36:08 sd-163808 caddy[103637]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
Mar 31 19:36:08 sd-163808 caddy[103637]: HOME=/var/lib/caddy
Mar 31 19:36:08 sd-163808 caddy[103637]: LOGNAME=caddy
Mar 31 19:36:08 sd-163808 caddy[103637]: USER=caddy
Mar 31 19:36:08 sd-163808 caddy[103637]: INVOCATION_ID=1a4d985b16f24b0bbd3a6c2e1ad7357c
Mar 31 19:36:08 sd-163808 caddy[103637]: JOURNAL_STREAM=9:757470
Mar 31 19:36:08 sd-163808 caddy[103637]: {"level":"info","ts":1617212168.7591827,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Mar 31 19:36:08 sd-163808 caddy[103637]: {"level":"info","ts":1617212168.7677064,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}
Mar 31 19:36:08 sd-163808 caddy[103637]: {"level":"info","ts":1617212168.7683446,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000493730"}
Mar 31 19:36:08 sd-163808 caddy[103637]: {"level":"info","ts":1617212168.7685227,"logger":"http","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
Mar 31 19:36:08 sd-163808 caddy[103637]: {"level":"info","ts":1617212168.768588,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
Mar 31 19:36:08 sd-163808 caddy[103637]: {"level":"info","ts":1617212168.771519,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["team-tabulos.com"]}
Mar 31 19:36:08 sd-163808 caddy[103637]: {"level":"info","ts":1617212168.7744782,"logger":"tls","msg":"cleaned up storage units"}
Mar 31 19:36:08 sd-163808 caddy[103637]: {"level":"info","ts":1617212168.841473,"msg":"autosaved config","file":"/var/lib/caddy/.config/caddy/autosave.json"}
Mar 31 19:36:08 sd-163808 caddy[103637]: {"level":"info","ts":1617212168.841576,"msg":"serving initial configuration"}
Mar 31 19:36:30 sd-163808 caddy[103637]: {"level":"error","ts":1617212190.3053584,"logger":"http.log.access","msg":"handled request","request":{"remote_addr":"88.163.254.7:4121","proto":"HTTP/2.0","method":"GET","host":"team-tabulos.com","uri":"/index.php","headers":{"Cookie":["PHPSESSID=p2du122j9dflhrui2n4dgaj3uu; _ga=GA1.2.247871532.1617000897"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15"],"Accept-Language":["fr-fr"],"Accept-Encoding":["gzip, deflate, br"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","proto_mutual":true,"server_name":"team-tabulos.com"}},"common_log":"88.163.254.7 - - [31/Mar/2021:19:36:30 +0200] \"GET /index.php HTTP/2.0\" 404 16","duration":0.00212895,"size":16,"status":404,"resp_headers":{"Server":["Caddy"],"Status":["404 Not Found"],"X-Powered-By":["PHP/7.2.24"],"Content-Type":["text/html; charset=UTF-8"]}}
Mar 31 19:36:42 sd-163808 caddy[103637]: {"level":"error","ts":1617212202.4979668,"logger":"http.log.access","msg":"handled request","request":{"remote_addr":"107.180.88.41:48652","proto":"HTTP/1.1","method":"GET","host":"team-tabulos.com","uri":"/wp-login.php","headers":{"Referer":["http://team-tabulos.com/wp-login.php"],"Accept-Encoding":["gzip"],"Connection":["close"],"User-Agent":["Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"]},"tls":{"resumed":false,"version":771,"cipher_suite":49196,"proto":"","proto_mutual":true,"server_name":"team-tabulos.com"}},"common_log":"107.180.88.41 - - [31/Mar/2021:19:36:42 +0200] \"GET /wp-login.php HTTP/1.1\" 404 16","duration":0.001768437,"size":16,"status":404,"resp_headers":{"Server":["Caddy"],"Content-Type":["text/html; charset=UTF-8"],"Status":["404 Not Found"],"X-Powered-By":["PHP/7.2.24"]}}
5. What I already tried:
I’ve tried to fiddle with the php-fpm config file in order to improve log level as well, but no really helpful anyway.
How can I get better log level?