Logs record what the server actually did, so they answer questions that error pages can't. This guide shows where each log lives on cPanel hosting and on a Linux VPS, and the few commands you need to find the relevant line fast.
Before you start
- The time the problem happened (logs are usually in server time or UTC).
- cPanel access, or SSH for a VPS (connect over SSH).
Logs on cPanel hosting
| What you need | Where |
|---|---|
| Recent web server errors | cPanel → Metrics → Errors |
| PHP errors for a script | error_log file in the script's folder; see PHP errors and error_log |
| Every visit (IP, URL, status code) | cPanel → Metrics → Raw Access; see raw access logs |
| Email delivery attempts | cPanel → Email → Track Delivery |
| CPU and memory limit hits | cPanel → Metrics → Resource Usage |
Logs on a Linux VPS
| Service | Ubuntu / Debian | AlmaLinux / Rocky |
|---|---|---|
| Nginx | /var/log/nginx/access.log, error.log | |
| Apache | /var/log/apache2/ | /var/log/httpd/ |
| PHP-FPM | /var/log/php8.3-fpm.log | /var/log/php-fpm/ |
| MySQL / MariaDB | /var/log/mysql/error.log | /var/log/mariadb/ or /var/lib/mysql/*.err |
| SSH logins | /var/log/auth.log | /var/log/secure |
/var/log/mail.log | /var/log/maillog | |
| Docker containers | docker logs NAME; see Docker logs | |
Commands that find the line you need
Watch a log live while you reload the failing page:
tail -f /var/log/nginx/error.logShow the last 100 lines:
tail -n 100 /var/log/nginx/error.logSearch for a word, ignoring case:
grep -i "fatal" /var/log/php8.3-fpm.logFind all 5xx responses in an access log:
awk '$9 ~ /^5/' /var/log/nginx/access.log | tail -n 50Read a systemd service log since a time:
journalctl -u nginx --since "1 hour ago"How to read what you find
- Match the timestamp to when the error happened.
- Read the newest relevant line first, then a few lines above it for context.
- Copy the key part of the message (for example
upstream timed outorAccess denied for user) and search our guides for it.
Tip: Logs can contain IP addresses and email addresses. Share only the relevant lines when you send them to support or post them online.
