Linux getting started Tutorial: Where is the location of the Apache Error Log On Linux?
Q: I am trying to solve the Apache Web Server Error on my Linux system. Where is the Apache error log file stored in [XX Linux Version?
Error logs and access log files provide system administrators with useful information, such as troubleshooting Web servers and protecting the system from various malicious activities, or you just need to perform various analyses to monitor the HTTP server 【]. Depending on your Web server configuration, the error/access logs may be stored in different locations in your system.
This article helps you find the Apache error log on Linux.
Location of Apache error logs on Debian, Ubuntu, or Linux Mint
Default Error Log
On Debian-based Linux, the default location of Apache error logs in the system range is/var/log/apache2/error. log. The default location can be modified by editing the Apache configuration file.
Custom error logs
To locate a custom error log location, open/etc/apache2/apache2.conf in a text editor and search for rows starting with ErrorLog, this row specifies the location of the custom Apache error log file. For example, you can find the following lines in the unmodified Apache configuration file:
ErrorLog ${APACHE_LOG_DIR}/error.log
In this example, APACHELOGConfigure the DIR environment variable, which has been defined in/etc/apache2/envvars.
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX
In practice, ErrorLog may point to any path in your Linux system.
Error logs customized by Virtual Hosts
If a virtual host is used on the Apache Web server, the ErrorLog command may be specified in the virtual host container. In this case, the System-Range Error Log location mentioned above will be ignored.
After a VM is enabled, each VM can define its own custom error log location. To locate the error log location of a specific Vm, you can open/etc/apache2/sites-enabled /. conf, and then find the ErrorLog command, which will display the error log file specified by the site.
Apache Error Log location on CentOS, Fedora, or RHEL
Default Error Log
In Red Hat-based Linux, Apache error log files in the system are stored in/var/log/httpd/error_log by default. The default location can be customized by modifying the Apache configuration file.
Custom error logs
To locate the custom location of Apache error logs, open/etc/httpd/conf/httpd in the text editor. conf, and then find ServerRoot. This parameter shows the top layer of the Apache Web server directory tree, where the log files and configurations are located. For example:
ServerRoot"/etc/httpd"
Now, find the row starting with ErrorLog, which indicates where the Apache Web server writes the error log. Note that the specified location is the relative location of the ServerRoot value. For example:
ErrorLog"log/error_log"
Combined with the preceding two commands, you can obtain the complete error Log Path, Which is/etc/httpd/logs/error by default.Log. In the newly installed Apache, this is an error in/var/log/httpd/error.Log symbolic link.
In practice, ErrorLog may point to any location in your Linux system.
Error logs customized by Virtual Hosts
If you have enabled the VM, you can check/etc/httpd/conf/httpd. conf (or any other file that defines the virtual host) to locate the error log location of each virtual host. Find the ErrorLog in the independent virtual host area. For example, in the following virtual host section, the error log is located at/var/www/xmodulo.com/logs/error_log.
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/xmodulo.com/public_html
ServerName www.xmodulo.com
ServerAlias xmodulo.com
ErrorLog /var/www/xmodulo.com/logs/error_log
CustomLog /var/www/xmodulo.com/logs/access_log
<VirtualHost>
Install a Web Server on Ubuntu Server 14.04 (Linux + Apache + MySQL + PHP)
Install and configure the PHP environment in Linux (Apache2)
How to enable Apache Rewrite in Ubuntu
Key points after upgrading Apache 14.04 to 2.2 in Ubuntu 2.4
Install the LAMP \ Vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04
Compile and install LAMP in CentOS 5.9 (Apache 2.2.44 + MySQL 5.6.10 + PHP 5.4.12)
Source code for Web server architecture in RedHat 5.4 build the LAMP environment and application PHPWind
Build a WEB Server Linux + Apache + MySQL + PHP in the LAMP source code Environment
Apache details: click here
Apache: click here
Via: http://ask.xmodulo.com/apache-error-log-location-linux.html
Author: Dan Nanni Translator: GOLinux Proofreader: wxy
This article was originally translated by LCTT and launched with the Linux honor in China
This article permanently updates the link address: