Troubleshooting

How to read server logs to troubleshoot your website

Where to find web, PHP, mail, database and system logs on cPanel hosting and a Linux VPS, and how to search them quickly to find the cause of an error.

IntermediatecPanel hosting and Linux VPS2 min read

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 needWhere
Recent web server errorscPanel → Metrics → Errors
PHP errors for a scripterror_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 attemptscPanel → Email → Track Delivery
CPU and memory limit hitscPanel → Metrics → Resource Usage

Logs on a Linux VPS

ServiceUbuntu / DebianAlmaLinux / 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
Mail/var/log/mail.log/var/log/maillog
Docker containersdocker 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.log

Show the last 100 lines:

tail -n 100 /var/log/nginx/error.log

Search for a word, ignoring case:

grep -i "fatal" /var/log/php8.3-fpm.log

Find all 5xx responses in an access log:

awk '$9 ~ /^5/' /var/log/nginx/access.log | tail -n 50

Read a systemd service log since a time:

journalctl -u nginx --since "1 hour ago"

How to read what you find

  1. Match the timestamp to when the error happened.
  2. Read the newest relevant line first, then a few lines above it for context.
  3. Copy the key part of the message (for example upstream timed out or Access 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.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.