Monday 16 December 2019

NGINX: Disable access log for specific requests


Below statement is used to disable logging.
access_log off;

Example
location = /about{
    access_log off;

    return 200 "Hello Welcome to NGINX";
}

nginx.conf

events {
    
}

http {
    include mime.types;

    server {
        listen 9090;

        server_name localhost;

        location = /about{
            access_log off;

            return 200 "Hello Welcome to NGINX";
        }

        location = /not_found{
            return 404 "File can't be found";
        }
    }
}



Previous                                                    Next                                                    Home

No comments:

Post a Comment