1. Caddy version (caddy version
):
2
2. How I run Caddy:
systemctl start caddy
a. System environment:
CentOS 8
b. Command:
systemctl start caddy
c. Service/unit/compose file:
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.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
d. My complete Caddyfile or JSON config:
www.example.com {
log {
output file /var/log/caddy/caddy.log
}
file_server * browse {
root /var/www/html
}
}
3. The problem I’m having:
Instead of responding with status 200 and the web page index.html,. Caddy responds with status 403, forbidden.
4. Error messages and/or full log output:
{"level":"error","ts":1598277948.5061944,"logger":"http.log.access.log0","msg":"handled request","request":{"method":"GET","uri":"/","proto":"HTTP/2.0","remote_addr":"1.2.3.4:58953","host":"www.example.com","headers":{"Accept-Encoding":["gzip, deflate, br"],"Upgrade-Insecure-Requests":["1"],"Cache-Control":["max-age=0"],"Te":["trailers"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.5"]},"tls":{"resumed":false,"version":772,"ciphersuite":4865,"proto":"h2","proto_mutual":true,"server_name":"www.example.com"}},"common_log":"1.2.3.4 - - [24/Aug/2020:14:05:48 +0000] \"GET / HTTP/2.0\" 403 0","duration":0.000274589,"size":0,"status":403,"resp_headers":{"Server":["Caddy"]}}
5. What I already tried:
file_server * browse