Nginx – How to disable Nginx logging

nginx

I have the following in config file

server {
    listen       80;
    server_name  _;
    access_log  /var/log/nginx/access.log  main;
  ...

server {
    listen       80;
    server_name  example.com
    access_log  off;
    error_log off;

But it is still keep logging for example.com virtual host. What am I doing wrong?

Best Answer

You are missing ; after server_name directive. access_log and off are being treated as additional server_names.

Related Topic