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)
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/
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/
Nginx (last 30 lines):
tail -30 /var/log/nginx/error.log
Apache:
tail -30 /var/log/apache2/error.log
Open the log in follow mode and reproduce the error in the browser:
tail -f /var/log/nginx/error.log
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
| Error | Cause |
| connect() to unix:/run/php/php-fpm.sock failed | PHP-FPM is not running or socket is unavailable |
| Permission denied | Incorrect file permissions on site files |
| client intended to send too large body | Upload size limit exceeded (client_max_body_size) |
| upstream timed out | PHP script is taking too long to execute |
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.