Optimizing Nginx For Performance Pt3 : Disable Access Logs and Reduce Disk Writes

NGINX Tweaks and Performance Tips

Part 3: Disable Access Logs to Reduce Disk Writes

Access Logs Explained: Nginx records (writes) each and every request to a file called ‘access.log’.  Each visit to your website might result in dozens of individual requests and nginx logs all of this information.  Many people need this information for troubleshooting or analytics purposes, but  If you don’t require need this  information then it’s preferable to disable access logging in your configuration.  This will not only reduce disk writes on your server, but it will also reduce disk utilization as well.  If you’re using nginx as a reverse proxy for another server (like apache), then this becomes super redundant for you and completely pointless to leave enabled (as apache will also be logging the accessed data).

To disabled access logging, you can edit the access_log directive to reflect the following (Below):

access_log off;

If you’re curious to see what type of information is being logged before you disable it, you can tail the access log by running the following command:

[scott@webserver ~]# tail /var/log/nginx/access.log

(Replace /var/log/nginx/access.log with the path to your log file)

Founder & CEO

Lyron Foster is a Prolific Multinational Serial Entrepreneur, Blogger, Author, IT Trainer, Polyglot Coder, Real Estate Investor and Technologist.

Related Posts

Write a comment