Configure Custom logs in nginx.conf vs. server blocks

How To Configure Custom logs in nginx.conf vs. server blocks. Nginx define logs in nginx.conf vs. server blocks.

Custom logs in nginx.conf vs. server blocks
Custom logs in nginx.conf vs. server blocks


If I enable access and error logs in /etc/nginx/nginx.conf:
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
Should I also be keeping logs in server blocks like:
server {
    listen 80;
    server_name www.somesite.org;
    root /var/www/somesite/;
    access_log /var/log/nginx/somesite.org.access.log;
    error_log /var/log/nginx/somesite.org.error.log;
}
Or this is redundant assuming that everything that's in "somesite" specific logs is already captured by master logs defined in nginx.conf?
I do have several virtual hosts though and I am wondering if above is true, would it be a better practice to disable logging in nginx.conf and log in individual server blocks so that I can keep domain name specific logs nice and clean?


0 Response to "Configure Custom logs in nginx.conf vs. server blocks"

Post a Comment