Help Center

Where are NGINX logs stored?

NGINX cache is highly recommended to more effectively leverage server resources. It does not negatively impact the functionality of websites, as the .htaccess file continues to work correctly.

NGINX Logs by Domain

Logs are saved by domain in separate folders. You can find them at the following path:

/var/log/nginx/domains

Viewing Logs

To view the last 100 saved logs of a specific domain, replace "NAME" with the domain name in the following command:

tail -100 /var/log/nginx/domains/NAME

Searching for Specific Logs

You can combine instructions to search for a specific log. For example, to search for access from an IP to a particular domain, use the following command, replacing "SEARCH_CRITERIA" with the desired search term and "NAME" with the domain name:

grep -i SEARCH_CRITERIA /var/log/nginx/domains/NAME

 

Practical Example

Suppose you want to see the last 100 logs of the domain example.com and search for accesses from the IP 192.168.1.1. The commands would be as follows:

View the last 100 logs:

tail -100 /var/log/nginx/domains/example.com

Search for accesses from IP 192.168.1.1:

grep -i "192.168.1.1" /var/log/nginx/domains/example.com

Implementing NGINX cache and properly managing domain logs are essential practices to improve the performance and management of a web server. By following these steps and using the provided commands, you can optimize the operation of your websites and facilitate the analysis of accesses and errors.

Last updated: 22 de mayo de 2024

Estimated reading time: 2 minutes

Did this article help you?
Let's Do It!

Start TODAY for only $2.45/month

Includes a web builder, 30GB of cloud storage, +200 Apps, and professional email.

Sign Up Now