I’m using nginx/1.22.1 as a reverse proxy and like to make the proxy log into different files. I’v a longish /etc/nginx/sites-available/default with quite a few different access_log-settings. Most of them do work perfectly fine and do write different access-logs. But there is one server driving me crazy and not writing its own log. I expected to read requests to dav.kidding.com in /var/log/nginx/access-radicale.log but do find these requests in /var/log/nginx/access-kidding.com.log
default starts like this:
server {
listen 80;
server_name dav.kidding.com;
access_log /var/log/nginx/access-radicale.log;
add_header Proxy local;
location / {
proxy_pass http://192.168.178.42:5232;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
# https://stackoverflow.com/questions/62664348/cant-get-clients-real-ip-when-using-nginx-reverse-proxy
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Remote-User $remote_user;
}
client_max_body_size 40M;
}
server {
listen 80;
server_name kidding.com;
access_log /var/log/nginx/access-kidding.com.log;
add_header Proxy local;
location / {
proxy_pass http://192.168.178.42:8008;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
# https://stackoverflow.com/questions/62664348/cant-get-clients-real-ip-when-using-nginx-reverse-proxy
proxy_set_header X-Real-IP $remote_addr;
}
client_max_body_size 40M;
}
nginx seems to ignore first access_log while anything else from that section apparently is accepped and works well. Can anybody give me a hint how I can make nginx write /var/log/nginx/access-radicale.log?
On stackoverflow I was told to be off topic with this but the guess there was that the first server dav.kidding.com might not be loaded at all. So I changed nginx.conf according to this and added error_log /var/log/nginx/error.log debug;
From what I find in error.log dav.kidding.com is loaded and operating (no complaints logged) but still /var/log/nginx/access-radicale.log is missing. How to get that written?