Nginx Disable Access log

On a high traffic web site, i want to disable access log as we are hitting I/O Limit. Since we don’t use this access log for anything now, there is no point keep writing it to a file. To disable, you need to add following to server entry for your web site.

access_log off;

Here is an example nginx config with access logs disabled.

server {
    server_name server3.serverok.in www.server3.serverok.in;
    listen 80;
    listen 443 ssl;
    ssl_certificate /etc/ssl/ssl.cert;
    ssl_certificate_key /etc/ssl/ssl.key;
    root /home/server3/public_html;
    index index.html;
    limit_rate_after 10m;
    limit_rate 512k;
    access_log off;
    location / {
        valid_referers none serverok.in www.serverok.in;
        if ($invalid_referer) {
            return 403;
        }
    }
}

Advertisement

Add a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement