One of the companies, where I'm employed runs nginx as a CDN (Content Delivery Network) server.
Actually nginx, today has become like a standard for delivering tremendous amounts of static content to clients.
The nginx, server load has recently increased with the number of requests, we have much more site visitors now.
Just recently I've noticed the log files are growing to enormous sizes and in reality this log files are not used at all.
As I've used disabling of web server logging as a way to improve Apache server performance in past time, I thought of implying the same little "trick" to improve the hardware utilization on the nginx server as well.
To disable logging, I proceeded and edit the /usr/local/nginx/conf/nginx.conf file, commenting inside every occurance of:
access_log /usr/local/nginx/logs/access.log main;
to
#access_log /usr/local/nginx/logs/access.log main;
Next, to load the new nginx.conf settings I did a restart:
nginx:~# killall -9 nginx; sleep 1; /etc/init.d/nginx start
I expected, this should be enough to disable completely access.log, browser request logins. Unfortunately /usr/local/nginx/logs/access.log was still displaying growing with:
nginx:~# tail -f /usr/local/nginx/logs/access.log
After a bit thorough reading of nginx.conf config rules, I've noticed there is a config directive:
access_log off;
Therefore to succesfully disable logging I had to edit config occurance of:
access_log /usr/local/nginx/logs/access.log main
to
After a bit thorough reading of nginx.conf config rules, I've noticed there is a config directive:
access_log off;
Therefore to succesfully disable logging I had to edit config occurance of:
access_log /usr/local/nginx/logs/access.log main
to
access_log /usr/local/nginx/logs/access.log main
access_log off;
Finally to load the new settings, which thanksfully this time worked, I did nginx restart:
nginx:~# killall -9 nginx; sleep 1; /etc/init.d/nginx start
And hooray! Thanks God, now nginx logging is disabled!
As a result, as expected the load avarage on the server reduced a bit 🙂
More helpful Articles
Tags: apache, apache server, Auto, avarage, browser, CDN, conf, config, config rules, content delivery network, Draft, enormous sizes, file, god, hardware, hooray, init, killall, log browser, logs, network server, nginx, occurance, performance, quot, reading, request, Result, server load, server logging, server performance, sleep, static content, time, today, usr, utilization, way, web server
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.28) Gecko/20120306 Firefox/3.6.28
Thanks
View CommentView CommentMozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.57 Safari/537.1
Ho, you notice speed improvement ?
Check /etc/nginx/off ….. doh’ here your log file !
View CommentView CommentMozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
thx 🙂
View CommentView Comment