By newbie
Hello, can someone tell me where is the location of access.log file? i need to check every page thats been generating by my visitors. can that be done by access.log file? my server is nginx by the way.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
This comment has been deleted
The location of your access.log file should be defined in your /etc/nginx/nginx.conf file or your site configuration file within your server block. By default, this would be in /etc/nginx/sites-available.
Look for the access_log directive.
If it has not been defined, you can define it using the snippet below (for simplicity, this should go in /etc/nginx/nginx.conf):
log_format compression '$remote_addr - $remote_user [$time_local] '
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" "$gzip_ratio"';
access_log /path/to/access.log compression buffer=32k;
… just make sure you change the last line and set /path/to/access.log to an actual path.
You don’t need to create the access.log file, NGINX will do this for you automatically, though the directories in the path must exist, so if the path you choose does not exist, you’ll need to create it before restarting NGINX.
After any/all changes to configuration files:
service nginx reload
```
... so that the changes will take effect.
--
That said, the `access.log` file won't tell you anything about pages that have been generated (as in created). What it will tell you (referencing the snippet above) is the IP Address, Time of Request, Path Requested, Status of Request, Size of Request, the Request Referrer, User Agent (i.e. web browser) and whether the request was compressed (via GZIP).
Outside of that scope, logging page creation would be the responsibility of your application, if pages are being created via the script. This would either be the result of custom code or an already available option.
NGINX will give you information on the request, though it's not meant to be a all-inclusive logging solution.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.