I want to solve the Linux system on the Apache WEB server error, apache error log files can not find, I would like to put in which directory?
The Apache log file provides system administrators with useful information, such as troubleshooting the WEB server, protecting the system from a variety of malicious activities, or simply doing a variety of analysis to monitor the HTTP server. Depending on your WEB server configuration, the error/access log may be placed in different locations in your system.
This article will help you find the Apache error log on Linux.
Apache error log location on Debian,ubuntu or Linux Mint
Default error log
On Debian based Linux, the default location for the system-wide Apache error log is/var/log/apache2/error.log. The default location can be modified by editing the Apache configuration file.
Custom error Log
To locate a custom error log location, open/etc/apache2/apache2.conf with a text editor, and then locate the row that starts with ErrorLog, which specifies the location of the custom Apache error log file. For example, the following lines can be found in the unmodified Apache configuration file:
ErrorLog ${apache_log_dir}/error.log
In this case, the location is configured with the APACHELOGDIR environment variable, which is defined in/etc/apache2/envvars.
Export Apache_log_dir=/var/log/apache2$suffix
In reality, ErrorLog may point to any path in your Linux system.
Using the virtual host custom error log
If a virtual host is used on the Apache Web server, the ERRORLOG directive may be specified within the Virtual host container, in which case the system-wide error log location described above will be ignored.
When a virtual host is enabled, individual virtual hosts can define their own custom error log locations. To find the error log location for a particular virtual host, you can open the/etc/apache2/sites-enabled/.conf and look for the ErrorLog instruction, which displays the error log file specified by the site.
Apache error log location on Centos,fedora or Rhel
Default error log
In Linux based on Red Hat, the system-wide Apache error log files are placed by default in/var/log/httpd/error_log. This default location can be customized by modifying the Apache configuration file.
Custom error Log
To find the custom location for the Apache error log, open/etc/httpd/conf/httpd.conf with a text editor, and then look for ServerRoot, which shows the top level of the Apache WEB Server directory tree. Both the log file and configuration are located in the directory tree. For example:
ServerRoot "/ETC/HTTPD"
Now, find the line at the beginning of ErrorLog, which indicates where the Apache Web server wrote the error log. Note that the specified position is the relative position of the ServerRoot value. For example:
ErrorLog "Log/error_log"
With the two instructions above, you get the full error log path, which is/etc/httpd/logs/errorlog by default. In the newly installed Apache, this is a symbolic link to the/var/log/httpd/errorlog.
In reality, ErrorLog may point to any location in your Linux system.
using the virtual host custom error log
If you enable a virtual host, you can find the error log location for each virtual host by checking/etc/httpd/conf/httpd.conf (or any other file that defines a virtual host). Find ErrorLog in the standalone Virtual host section. For example, in the following virtual host section, the location of the error log is/var/www/xmodulo.com/logs/error_log.
<virtualhost *:80>
ServerAdmin webmaster@xmodulo.com
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>
the Apache log Setup tutorial under Windows system
Note: Apache installation directory changed to your own
The Apache default log is in the logs directory under the installation directory, for example: D:\Apache Software foundation\apache2.2\logs
Sometimes you need to set it to a different directory, but in many cases you should set it to another directory.
The configuration file is the httpd.conf file in the Conf directory under the installation directory, the default configuration:
ErrorLog "Logs/error.log"
Logformat "%h%l%u%t \%r\"%>s%b "Commoncustomlog" Logs/access.log "common"
If you modify the path directly, the date setting is problematic, and the methods found on the Web are as follows:
ErrorLog "|bin/rotatelogs.exe e:/log/apache/error-%y-%m-%d.log 86400" Logformat "%h%l%u%t \"%r\ "%>s%b" CommonCusto Mlog "|bin/rotatelogs.exe e:/log/apache/access.log" common
If there are multiple sites, you need to set up for multiple sites, set in VirtualHost
<virtualhost *:80>
Proxypreservehost on ServerAdmin admin ServerName www.yingbuluo.com
Proxypass/http://www.yingbuluo.com:8082/proxypassreverse/http://www.yingbuluo.com:8082/setenv force-proxy-requ est-1.0.1 setenv proxy-nokeepalive 1
Logformat "%h%l%u%t \%r\"%>s%b \ "%{referer}i\" \ "%{user-agent}i\" "Combinedcustomlog" |bin/rotatelogs.exe E:/log/ Apache/weba/access-%y-%m-%d.log 86400 "combined
</VirtualHost>