Logfile Not Created Auto

1. Caddy version (caddy version):

v2.1.1 h1:X9k1+ehZPYYrSqBvf/ocUgdLSRIuiNiMo7CvyGUQKeA=

2. How I run Caddy:

systemctl start caddy

a. System environment:

ubuntu 18.04

b. Command:

paste command here

c. Service/unit/compose file:

paste full file contents here

d. My complete Caddyfile or JSON config:

:180 {
file_server
root * /var/www/html

log {
	output file /var/log/access.log
}
}

3. The problem I’m having:

4. Error messages and/or full log output:

After restart caddy, and refresh my webbrowser , I checked /var/log director, No access.log created.

5. What I already tried:

And if I create /var/log/access.log ,and chown it to caddy:caddy, then refresh the browser, I can see the log writen to access.log

6. Links to relevant resources:

The caddy user doesn’t have permissions to create files in /var/log. This isn’t a problem with Caddy. You just need to pick a file location it has permissions to. The $HOME for the caddy user is /var/lib/caddy, so you could put your logs in there.

1 Like

Thank you very much!

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.