1. The problem I’m having:
Since then I’m using Apache and Nginx. Now I’d like to switch to Caddy because of the h3 support.
I’m wondering how to set up separate error and access logs. I’ve read the documentation on how to do this, but I can’t get my head around it.
Here is what I’ve used until now.
Apache
ErrorLog logs/error.log
LogLevel warn
<IfModule mod_log_config.c>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
CustomLog logs/access.log combined
</IfModule>
Nginx
error_log /var/log/nginx/error.log warn;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
For Caddy, I understand how to define access log, but I don’t understand how to define a separate access and error log.
2. Error messages and/or full log output:
none
3. Caddy version:
2.6.4
4. How I installed and ran Caddy:
dpkg
a. System environment:
Debian 12 bookworm (testing)
d. My complete Caddy config:
domain.tld {
root * /srv/caddy/domain.tld/public
encode gzip
php_fastcgi unix//run/php/php8.2-fpm.sock
file_server {
index index.php
}
log {
output file /var/log/caddy/access.log
}
}