NGINX caching is highly recommended to make more effective use of server resources. It does not have a negative impact on website performance, as the
file continues to work correctly.
NGINX Logs per Domain
Logs are stored per domain in separate folders. You can find them at the following path:
Viewing the Logs
To view the last 100 stored log entries for a specific domain, replace "NAME" with the domain name in the following command:
- tail -100 /var/log/nginx/domains/NAME
Searching for Specific Log Entries
You can combine commands to search for a specific log entry. For example, to search for an IP access 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
Let's say you want to view the last 100 log entries for the domain example.com and search for access from the IP 192.168.1.1. The commands would be as follows:
View the last 100 log entries:
- tail -100 /var/log/nginx/domains/example.com
Search for access from IP 192.168.1.1:
- grep -i "192.168.1.1" /var/log/nginx/domains/example.com
Implementing NGINX caching and properly managing per-domain logs are essential practices for improving the performance and administration of a web server. By following these steps and using the provided commands, you can optimize the operation of your websites and streamline the analysis of access and error logs.
Related Articles
How to install and configure Nginx as a reverse proxy in cPanel/WHM 🚀
What is Nginx and why use it with cPanel? Nginx is a high-performance web server that can function as a reverse proxy in front of Apache on cPanel servers. This configuration allows Nginx to handle static files (images, CSS, JavaScript) while Apache ...
Fix MySQL Stored Procedures Import Error in cPanel
When working with MySQL databases that include stored procedures, it's common to encounter errors during import in shared hosting environments with cPanel. These errors are usually related to the DEFINER parameter, which specifies the owner of the ...
Basic SSH commands
FILE MANAGEMENT Copy file cp -a archivo.zip archivocopia.zip Create a 404.html file touch /home/usuario/public_html/404.html Compress directory zip -r archivo.zip /home/usuario/public_html/directorio Extract file unzip archivo.zip View contents of a ...
JetBackup 5: How to fix the Integrity Check error using CLI/SSH
When JetBackup performs its automated integrity verification processes, they may sometimes complete partially due to network interruptions, timeouts, or communication issues with the remote storage destination. If you receive notifications indicating ...
How to Get Server Hardware Information on AlmaLinux
Knowing the hardware specifications of your dedicated server or VPS is essential for making informed decisions about resource sizing, diagnosing performance issues, and planning future upgrades. In this article, you will learn how to obtain detailed ...