English (change)

Let’s take a quick look at our Nginx server and site error & access logs, and where to find them.
You have one pair of Nginx logs server-wide and another for each site, unless you omitted them. The error logs do just that, log any errors. The access logs show what web elements have been resolved by IP address and when.
Those who followed Serve Multiple Sites & Blogs with Virtual Hosts mapped out the location of the logs in each site or blogs virtual host file or, if you bundled each site’s configuration in your nginx.conf file, the locations to the files are given there.
Here’s a reminder anyhow.
[sniplet guvSellBox]
[sniplet vpsIndexSell]
To list them:-
[text]ls -l /usr/local/nginx/logs[/text]
Or to open them:-
[text]sudo nano /usr/local/nginx/logs/error.log[/text]
.. substituting error.log for access.log as appropriate.
Or if you installed Nginx using the package manager, rather than compiling from source as is recommended in the VPS Bible, they’re here:-
[text]sudo nano /etc/nginx/logs[/text]
[text]sudo nano /home/public_html/someSite.com/log/access.log[/text]
And the error page:-
[text]sudo nano /home/public_html/someSite.com/log/error.log[/text]
In the case of the error log, hopefully it is indeed empty. With the access log, maybe it’s just too darn big and is taking a long time to open. If you really want to look at it, be patient. Else delete it and add a new, empty one:-
[text]sudo rm /home/public_html/someSite.com/log/access.log && sudo nano /home/public_html/someSite.com/log/access.log[/text]
.. saving the empty file.
[sniplet vpsIndex]
Related posts:
Moses January 19th, 2010 at 3:07 am
G’Day Guv,
A nice alternative to clearing the access log is
sudo rm /home/public_html/someSite.com/log/access.log && sudo touch /home/public_html/someSite.com/log/access.log
I have this as part of my daily backup script, the access.log was approaching 1GB after a few weeks which was accounting for more than 50% of my backup!
the_guv January 20th, 2010 at 8:02 pm
cheers Moses .. that’s a nice tip, appreciated.