NGINX Enable Access Logging

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.

/etc/nginx/

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.

/var/log/nginx/access.log

Tags: NGINX

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.

Categories

Vote!

What Web Browser Do You Use?

View Results

Loading ... Loading ...

Vote!

What do you prefer..VMware or Hyper-V?

View Results

Loading ... Loading ...