Check the Apache server on a Linux system error log

This article describes the view of the Apache server on a Linux system error log, server operation and maintenance is essential basics, need friends can refer to the
error log and access log files provide useful information for system administrators, such as for the Web server troubleshooting, protect the system against a variety of malicious activities violated, or just perform a variety of analyzes to monitor HTTP server. Depending on your Web server configuration, the error / access log may be placed in different locations on your system.

This article can help you find the Apache error log on Linux.
Apache error log locations on Debian, Ubuntu or Linux Mint
default error log

On Debian-based Linux, Apache error log, system-wide default location is /var/log/apache2/error.log. The default location can be modified by editing the Apache configuration file.
Custom error log

To find the location of a custom error log, open /etc/apache2/apache2.conf with a text editor, and then look at the line ErrorLog beginning of the line specifies the location of the Apache error log file of the custom. For example, the following line can be found in unmodified Apache configuration file:

ErrorLog $ {APACHE_LOG_DIR} /error.log
In the present embodiment, the location using configuration APACHELOGDIR environment variables, the variables are defined in the / etc / apache2 / envvars in.

export APACHE_LOG_DIR = / var / log / apache2 $ SUFFIX
In practice, ErrorLog may point to your Linux system, any path.
Virtual host custom error logs

If you are using a virtual host in the Apache Web server, ErrorLog directive may be specified in a virtual host container, in this case, the above mentioned error logging system-wide location will be ignored.

After the virtual host is enabled, each virtual host can define their own custom error log location. To find a particular virtual host error log locations, you can open /etc/apache2/sites-enabled/.conf, then look ErrorLog instructions specified in the error log file for the site will be displayed.
Apache error log locations on CentOS, Fedora or RHEL
default error log

In Red Hat-based Linux, system-wide default Apache error log file is placed in / var / log / httpd / error_log . The default location can be customized by modifying the Apache configuration file.
Custom error log

To find out the location of a custom Apache error log, open /etc/httpd/conf/httpd.conf with a text editor, and then find the ServerRoot, this parameter shows the top-level Apache Web server directory tree, log files and configuration are located the directory tree. E.g:

ServerRoot "/ etc / httpd"
Now, find the beginning ErrorLog line, the bank pointed out that the Apache Web server error log wrote about where to go. Note that the specified value is a relative position of ServerRoot. E.g:

ErrorLog "log / error_log"
binding two instructions above can be obtained complete error log path, the default path is the / etc / httpd / logs / errorlog case. In a fresh installation of Apache, which is a to / var / log / httpd / errorlog of symbolic links.

In practice, ErrorLog may point anywhere on your Linux system.
Virtual host custom error logs

If you enable virtual hosts, you can find various virtual hosts by checking /etc/httpd/conf/httpd.confhttp://www.bbqmw.net/ baby named network (or any other defined virtual host file) error log locations. Find ErrorLog in a separate virtual host part. For example, in the virtual host section below, the error log is /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>

Guess you like

Origin www.cnblogs.com/murongyuling/p/11009023.html