Where Are the Log Files? Apache, Nginx, PHP, MySQL and Mail Log Locations

Almost every troubleshooting guide ends the same way: check the error log. What they rarely say is where it is — and the answer depends on the service, the Linux distribution and the control panel. Apache writes to /var/log/apache2/ on Ubuntu and /var/log/httpd/ on AlmaLinux. cPanel keeps PHP errors in a file next to the script that failed. And on current Debian, some of the classic log files don’t exist at all.

This page collects the log locations for web servers, PHP, databases, mail and system logins across the common setups — and shows how to find a log that isn’t where it should be.

Last verified: September 2026. Default paths for current releases — Ubuntu 24.04, Debian 12, AlmaLinux and Rocky Linux 9, and current cPanel, DirectAdmin and Plesk. Any path can be changed in configuration; the last section shows how to find the real one.

The quick answer

LogUbuntu / DebianAlmaLinux / Rocky / RHEL
Apache errors/var/log/apache2/error.log/var/log/httpd/error_log
Apache access/var/log/apache2/access.log/var/log/httpd/access_log
Nginx errors/var/log/nginx/error.log/var/log/nginx/error.log
Nginx access/var/log/nginx/access.log/var/log/nginx/access.log
PHP-FPM/var/log/php8.3-fpm.log (the version is in the name)/var/log/php-fpm/error.log and /var/log/php-fpm/www-error.log
MySQL/var/log/mysql/error.log/var/log/mysql/mysqld.log
MariaDBOften only in the journal: journalctl -u mariadb/var/log/mariadb/mariadb.log
Mail/var/log/mail.log/var/log/maillog
SSH logins/var/log/auth.log/var/log/secure
System/var/log/syslog/var/log/messages
Cron/var/log/syslog (search for CRON) — on Debian 12, journalctl -u cron/var/log/cron

On a control panel, many of these move — see the cPanel, DirectAdmin and Plesk sections below. And for WordPress, the debug log is wp-content/debug.log, once WP_DEBUG_LOG is turned on — our guide to WordPress error logs covers it.

And for cron jobs, the log only tells you whether cron started a job: grep CRON /var/log/syslog on Ubuntu, journalctl -u cron on Debian 12, /var/log/cron on AlmaLinux and Rocky. If the job never appears there, the problem is usually the schedule itself — paste it into our cron job generator to see exactly when it runs. And if it appears but did nothing, the cause is in the command: our generator’s guide covers the five most common reasons cron jobs fail.

Ubuntu and Debian

The web server and database paths above are the defaults for the packages in Ubuntu and Debian. Two details catch people out:

The PHP-FPM log is for the service, not for your code. /var/log/php8.3-fpm.log records worker crashes and pool warnings, like “server reached pm.max_children”. PHP errors from your site go elsewhere — see “Where PHP errors actually go” below.

On Debian 12, syslog, auth.log and mail.log may not exist. Debian stopped installing rsyslog by default, and without it those files are never written — the same messages go to the systemd journal instead. Read them with journalctl:

journalctl -u ssh --since "1 hour ago"
journalctl -u postfix -n 100
journalctl -f
journalctl -u cron --since today

Installing rsyslog brings the classic files back. Ubuntu Server still installs it by default.

AlmaLinux, Rocky Linux and RHEL

The names change more than the folders. Apache is httpd, so its logs are in /var/log/httpd/ — and the files use an underscore: error_log and access_log, not error.log. System messages go to /var/log/messages, logins to /var/log/secure and mail to /var/log/maillog.

PHP-FPM keeps two files: /var/log/php-fpm/error.log for the service itself, and /var/log/php-fpm/www-error.log for PHP errors from the www pool — the one most sites run in. That second file is usually where a white screen’s cause is written.

cPanel

cPanel moves most logs out of the standard places:

LogLocation
Apache errors (whole server)/etc/apache2/logs/error_log — older servers: /usr/local/apache/logs/error_log
Access log per domain/etc/apache2/logs/domlogs/example.com (and example.com-ssl_log for HTTPS)
Access logs, for the account user~/access-logs/, with older archives in ~/logs/
PHP errorsAn error_log file in the folder of the script that failed — often public_html/error_log
PHP-FPM/opt/cpanel/ea-php83/root/usr/var/log/php-fpm/error.log — the number matches the PHP version
Exim (mail delivery)/var/log/exim_mainlog, plus exim_rejectlog and exim_paniclog
Dovecot (IMAP / POP3 logins)/var/log/maillog
MySQL / MariaDB/var/lib/mysql/<hostname>.err
cPanel and WHM/usr/local/cpanel/logs/ — error_log, access_log, login_log
ModSecurity/etc/apache2/logs/modsec_audit.log
LiteSpeed (if used)/usr/local/lsws/logs/error.log
Firewall (CSF / LFD)/var/log/lfd.log
Cron/var/log/cron — account users see their cron jobs, not the log, under Advanced → Cron Jobs

Without SSH access, cPanel shows the last lines of the Apache error log for your account under Metrics → Errors, and lets you download access logs under Metrics → Raw Access. The error_log files next to your scripts are visible in the File Manager — and a large one in public_html is usually the first clue to what’s breaking.

DirectAdmin

LogLocation
Apache, per domain/var/log/httpd/domains/example.com.error.log and example.com.log
Apache, whole server/var/log/httpd/error_log
Nginx, per domain/var/log/nginx/domains/
PHP-FPM/usr/local/php83/var/log/php-fpm.log — the number matches the PHP version
Exim/var/log/exim/mainlog, rejectlog and paniclog
MySQL / MariaDB/var/lib/mysql/<hostname>.err
DirectAdmin itself/var/log/directadmin/ — error.log, system.log, login.log

Account users can read their domain’s error and access logs in the DirectAdmin interface, under Site Summary / Statistics / Logs, without SSH.

Plesk

Plesk keeps logs per site under /var/www/vhosts/system/example.com/logs/ — error_log, access_log and, for HTTPS, access_ssl_log. The Plesk interface shows the same files under Websites & Domains → Logs. Plesk’s own panel log is /var/log/plesk/panel.log.

Where PHP errors actually go

This is the part that makes people give up. PHP errors don’t have one fixed location — they go to the first of these that applies:

  1. The file set in PHP’s error_log directive, if there is one. On cPanel, it’s the error_log file next to the script.
  2. The PHP-FPM pool’s error log, if the pool sets one — www-error.log on AlmaLinux.
  3. The web server’s error log, otherwise. On Nginx with PHP-FPM, PHP errors appear there prefixed with “FastCGI sent in stderr”.

To see which applies, check the error_log value on a phpinfo() page — and delete that page right after. Don’t trust php -i in the terminal: the command line often uses a different configuration file from the website. Our PHP default settings reference covers the other directives that differ between the two.

When a log isn’t where it should be

Ask each service where it writes:

ServiceCommand
Nginxsudo nginx -T | grep -E "error_log|access_log"
Apachegrep -Ri "ErrorLog|CustomLog" /etc/apache2 /etc/httpd 2>/dev/null
MySQL / MariaDBmysql -e "SELECT @@log_error;"
PHP (website)The error_log line on a phpinfo() page
Anything managed by systemdjournalctl -u <service> -n 100

And when you don’t know which file changed, list the most recently written logs:

sudo ls -lt /var/log | head

Reading logs without drowning in them

  • Follow a log live while you reproduce the problem: sudo tail -f /var/log/nginx/error.log
  • See only the last lines: sudo tail -n 100 /var/log/apache2/error.log
  • Search for errors: sudo grep -i "error" /var/log/php-fpm/www-error.log
  • Search rotated archives, which end in .gz: sudo zgrep -i "error" /var/log/nginx/error.log.*.gz

Logs are rotated — usually daily or weekly — so yesterday’s entries may be in error.log.1 and older ones in compressed files. If an error happened a few days ago, search those too.

The fastest route to a cause is almost always: follow the error log with tail -f, reproduce the problem once, and read the lines that appear. For what those errors mean, see our guides to the 500 Internal Server Error and the 504 Gateway Timeout.

Every log, one command away

A Copahost VPS gives you full root access to every log on the server — web server, PHP, database, mail and firewall — so you can follow an error live instead of guessing. On shared hosting, cPanel shows your site’s error and access logs from the dashboard.

See VPS plans →

Frequently asked questions

Where is the Apache error log?
On Ubuntu and Debian, /var/log/apache2/error.log. On AlmaLinux, Rocky Linux and RHEL, /var/log/httpd/error_log. On cPanel, the server-wide log is /etc/apache2/logs/error_log, and on DirectAdmin each domain has its own in /var/log/httpd/domains/.

Where is the Nginx error log?
/var/log/nginx/error.log on almost every distribution, with the access log next to it. If it isn’t there, run nginx -T and look for the error_log directive to see the real path.

Where are PHP errors logged?
In the file set by PHP’s error_log directive if there is one — on cPanel, an error_log file in the folder of the script that failed. Otherwise in the PHP-FPM pool’s log, or in the web server’s error log. Check the error_log value on a phpinfo() page to see which applies.

Where is the MySQL error log?
On Ubuntu and Debian, /var/log/mysql/error.log. On AlmaLinux and RHEL, /var/log/mysql/mysqld.log for MySQL or /var/log/mariadb/mariadb.log for MariaDB. On cPanel and DirectAdmin, /var/lib/mysql/ followed by the server’s hostname and .err. SELECT @@log_error; shows the real path.

Why is there no /var/log/syslog or auth.log on my server?
Because the server doesn’t run rsyslog, which writes those files. Debian 12 no longer installs it by default; the same messages go to the systemd journal, which you read with journalctl. Installing rsyslog brings the files back.

Where are cPanel’s logs?
Apache’s error log is /etc/apache2/logs/error_log, access logs per domain are in /etc/apache2/logs/domlogs/, mail delivery is in /var/log/exim_mainlog, and cPanel’s own logs are in /usr/local/cpanel/logs/. Without SSH, use Metrics → Errors and Metrics → Raw Access in cPanel.

Conclusion

“Check the log” is only useful advice if you know where the log is. On a plain server, the distribution decides: apache2 and error.log on Ubuntu, httpd and error_log on AlmaLinux, and on current Debian, the journal instead of syslog. On a control panel, the panel decides — and cPanel’s habit of writing PHP errors next to the script that failed is the one that surprises people most.

When a log still isn’t where it should be, ask the service itself: nginx -T, SELECT @@log_error, a phpinfo() page or journalctl. Then follow it live with tail -f, reproduce the problem once, and the answer is usually in the lines that appear.

Share the Post:
Picture of Gustavo Gallas

Gustavo Gallas

Graduated in Computing at PUC-Rio, Brazil. Specialized in IT, networking, systems administration and human and organizational development​. Also have brewing skills.