How to check web server logs (Apache/Nginx)

12.03.2026
Complexity
min.

Summary

Web server logs contain information about errors and requests. Check them to find the cause of website issues.

Applies to:
✔ VPS
✔ Dedicated servers
✔ Apache, Nginx
✔ Linux (Ubuntu, Debian, CentOS)

Log locations

Nginx

Error log:

/var/log/nginx/error.log

Access log:

/var/log/nginx/access.log

For individual sites, logs may be specified in the virtual host config:

grep -r "error_log|access_log" /etc/nginx/sites-enabled/

Apache

Error log:

/var/log/apache2/error.log

On CentOS/RHEL:

/var/log/httpd/error_log

Access log:

/var/log/apache2/access.log

Virtual host logs:

grep -r "ErrorLog|CustomLog" /etc/apache2/sites-enabled/

Viewing recent errors

Nginx (last 30 lines):

tail -30 /var/log/nginx/error.log

Apache:

tail -30 /var/log/apache2/error.log

Real-time error monitoring

Open the log in follow mode and reproduce the error in the browser:

tail -f /var/log/nginx/error.log

Searching errors by code

Find all 500 errors in the Nginx access log:

grep " 500 " /var/log/nginx/access.log | tail -20

Find PHP errors in the Apache log:

grep -i "php" /var/log/apache2/error.log | tail -20

Common log errors

ErrorCause
connect() to unix:/run/php/php-fpm.sock failedPHP-FPM is not running or socket is unavailable
Permission deniedIncorrect file permissions on site files
client intended to send too large bodyUpload size limit exceeded (client_max_body_size)
upstream timed outPHP script is taking too long to execute

Verification

After finding and fixing the error:

curl -I http://your-domain.com

Expected response: HTTP/1.1 200 OK

If you see errors in the logs that you cannot interpret, open a support ticket. Attach the last 50 lines of the error log.
Was this information helpful?
Yes   No
 
By continuing to use this website you will be agreeing to the website Acceptable Use Policy and the Use of Cookies while using the website and our services. Please also read our Privacy Policy under which, to the extent stated, you consent to the processing of your personal data.