Search at Knowledgebase
How to check Apache error logs on Linux Cloud Servers

Objective

There may arise situations when a website hosted in a Linux server does not work properly and shows up error messages. The website showing error can be attributed to several factors, some of which may include incorrect permissions for files/folders, issues with the services serving the website, missing files, corrupted files/database, etc.
In a Linux server having Apache as the webserver, the error logs of the Apache service helps considerably in troubleshooting such issues with the websites. Checking the error logs in real-time can often assist in analyzing and finding the cause of what went wrong with the website and thereby the way to fix it.
This guide outlines the basic steps to find out, wherein the server, the Apache error log can be located as well as the way in which the error log can be monitored in real-time.

Location of Apache Error Log

Apache error log, by default, can be found in the locations specified below, based on the Linux OS distribution in the server.

  • CentOS/Fedora: /var/log/httpd/error_log
  • Ubuntu/Debian: /var/log/apache2/error.log

To find the exact location of the Apache error log, the below grep commands can be used:

CentOS / Fedora:

# grep ErrorLog /etc/httpd/conf/httpd.conf

Ubuntu / Debian:

# grep ErrorLog /etc/apache2/apache2.conf

Checking Apache error log in real time

Once the location of the Apache error log has been found out, it can be monitored in real-time for checking on finding the cause of any error that a website is facing.
For this, execute the below commands in the server, and then browse the website having the error in a web browser. The logs related to the errors of the website will automatically be shown in real-time.

CentOS/Fedora:

# tail -f /var/log/httpd/error_log

Ubuntu/Debian:

# tail -f /var/log/apache2/error.log

To search for any particular word in the Apache error log, the grep command can be used as below. In the below examples, the word permission is being searched in the error log.

# grep -i permission /var/log/httpd/error_log  (CentOS/Fedora) 
# grep -i permission /var/log/apache2/error.log  (Ubuntu/Debian)

Checking Apache error log in WHM/cPanel server

By default, the Apache error log in a WHM/cPanel server is located in the path /usr/local/apache/logs/error_log.
Any errors with websites hosted in the cPanel server will be logged in this error log and it can be monitored in real-time to find the cause of the error, by executing the below command.

# tail -f /usr/local/apache/logs/error_log

The error logs for a domain can also be checked from cPanel for the domain by clicking on the option named Errors under Metrics section.
An example of an error message generated for a website in the Apache error log is shown below, the website name showing in the context of this guide is varidatasupport.com, with the cPanel username being varidatasuppor.
This error means that permission to access the index page of the website is denied, which usually refers to incorrect permission for the index file. The necessary permissions can be updated for the index file to resolve this issue.
The same error log can also be viewed from the cPanel of the domain by navigating to Metrics >> Errors.

Checking Apache error log in Plesk server

The location of the global Apache error logs in a Plesk server changes based on the type of Linux OS distribution in the server. The path of the error log is as provided below:

CentOS / RHEL: /var/log/httpd/error_log
Ubuntu / Debian: /var/log/apache2/error.log
Domain-specific error log: /var/www/vhosts/system//logs/error_log

Similar to cPanel server, the error log can be monitored in real time using the tail command as below:

# tail -f /var/www/vhosts/system//logs/error_log

The error logs for the domain can also be accessed from its Plesk panel, by clicking on the Logs option and then selecting the Apache error from the drop-down menu. Nginx error can also be selected if the server uses Nginx reverse proxy server.
An example of an error message generated for a website in the Apache error log is shown below, the website name showing in the context of this guide is varidatasupport.com.
This error means that the index page of the website failed to open, which usually refers to incorrect permission for the index file. The necessary permissions can be updated for the index file to resolve this issue.
The same error can also be viewed from the Plesk panel.

Your FREE Trial Starts Here!
Contact our Team for Application of Dedicated Server Service!
Register as a Member to Enjoy Exclusive Benefits Now!
Your FREE Trial Starts here!
Contact our Team for Application of Dedicated Server Service!
Register as a Member to Enjoy Exclusive Benefits Now!
Telegram Skype