How to Disable Nginx logs on your server

Nginx is a web server that focuses on performance and low memory usage. It is as of now one of the fastest growing web server.

If you wish to learn how to install Nginx on your Ubuntu server, you can go through this tutorial .

Sometimes you might get a large number of warnings in your Nginx logs. These warnings might not be affecting your site but the sheer number of them might be increasing your total server disk usage, or if you just wish to turn off the nginx logs for any other reason, you can do so as follows :

Open the 'nginx.conf' file (usually located : /etc/nginx folder) or the Nginx config file for a particular site, for which you wish to turn off nginx logs (usually located in : /etc/nginx/sites-available folder).

Find the line :

error_log    /var/log/nginx/error.log;

Some people simply change the line to the following :

error_log    off;

Please note that this will not stop the nginx logs from being created on the server. This will just create the logs in : '/usr/share/nginx/off' file.

If you wish to turn off the Nginx error logs completely, you need to change the line to :

error_log   /dev/null   crit;

This will completely turn off the Nginx error logs on your server.

Copyright © 2019 WPOven