NGINX Enable Access Logging

Written by Allen White on. Posted in Web

Had an issue over the last few weeks where some naughty people have been trying to DDOS and scrape Techieshelp. Techieshelp recently moved VPS provider and during this process moved from Apache to NGINX. By default it appears the NGINX does not enable its access logs so I did not have the data required to block the scrapers. People use the access logs to get an idea of the visitors who have been visiting their websites. This is how to enable the Access Logs in NGINX.

The file we need to edit is NGINX.CONF, it is normally located here.


To edit we use the following command:

nano /etc/nginx/nginx.conf

You will presented with a screen similar to below, scroll to the section that says access_log off: and change it to on.
enable access logs nginx

Once done save the file and exit nano, we can stop start or restart NGINX with the following command.

sudo service nginx start
sudo service nginx stop
sudo service nginx restart

Now your access logs will start to populate, you can view these logs at the following location.

Allen White
Allen is a Consultant for ITPS in the North East of England and holds the following accreditations. MCSA, MCSE, MCTS, MCITP, CCA, CCSP, VCP 4,5 and HP ASE, AIS - Network Infrastructure.

ITPS provides strategic IT consultancy, implementation, data centre provision and unified communications, as well as support services and workspace and disaster recovery. If you require a consultation then please contact me via the contacts section or direct on 07931222991, add me on linkedin.



(c) Please be aware, all information is provided freely, any information used is done so at your risk and Techieshelp will not be held responsible for any issue that may occur.
!-- BuySellAds On-Site Shopping Cart -->