diff --git a/sources/tech/20150518 Linux FAQs with Answers--What is the Apache error log location on Linux.md b/sources/tech/20150518 Linux FAQs with Answers--What is the Apache error log location on Linux.md deleted file mode 100644 index b25c7fe3c8..0000000000 --- a/sources/tech/20150518 Linux FAQs with Answers--What is the Apache error log location on Linux.md +++ /dev/null @@ -1,82 +0,0 @@ -Translating by GOLinux! -Linux FAQs with Answers--What is the Apache error log location on Linux -================================================================================ -> **Question**: I am trying to troubleshoot Apache web server errors on my Linux system. Where is the Apache error log file located on [insert your Linux distro]? - -Error log and access log files are a useful piece of information for system admins, for example to troubleshoot their web server, [protect][1] it from various malicious activities, or just to run [various][2] [analytics][3] for HTTP server monitoring. Depending on your web server setup, its error/access logs may be found in different places on your system. - -This post may help you **find Apache error log location on Linux**. - -![](https://farm8.staticflickr.com/7664/16958522954_4852ab5ea5_c.jpg) - -### Apache Error Log Location on Debian, Ubuntu or Linux Mint ### - -#### Default Error Log #### - -On Debian-based Linux, the system-wide default location of Apache error log is **/var/log/apache2/error.log**. The default location can be customized by editing Apache configuration file. - -#### Custom Error Log #### - -To find a custom error log location, open /etc/apache2/apache2.conf with a text editor, and look for a line that starts with ErrorLog. This line specifies a custom location of Apache error log file. For example, the unmodified Apache configuration file has the following line: - - ErrorLog ${APACHE_LOG_DIR}/error.log - -In this case, the location is configured using APACHE_LOG_DIR environment variable, which is defined in /etc/apache2/envvars. - - export APACHE_LOG_DIR=/var/log/apache2$SUFFIX - -In reality, ErrorLog may point to any arbitrary path on your Linux system. - -#### Custom Error Log with VirtualHost #### - -If VirtualHost is used in Apache web server, ErrorLog directive can be specified within VirtualHost container, in which case the system-wide error log location described above will be ignored. - -With VirtualHost enabled, each VirtualHost can define its own custom error log location. To find out the error log location of a particular VirtualHost, you can open /etc/apache2/sites-enabled/.conf, and look for ErrorLog directive, which will show a site-specific error log file. - -### Apache Error Log Location on CentOS, Fedora or RHEL ### - -#### Default Error Log #### - -On Red Hat based Linux, a system-wide Apache error log file is by default placed in **/var/log/httpd/error_log**. This default location can be customized by editing Apache configuration file. - -#### Custom Error Log #### - -To find out the custom location of Apache error log, open /etc/httpd/conf/httpd.conf with a text editor, and look for ServerRoot, which shows the top of the Apache server directory tree, under which log files and configurations are located. For example: - - ServerRoot "/etc/httpd" - -Now look for a line that starts with ErrorLog, which indicates where Apache web server is writing its error logs. Note that the specified location is relative to the ServerRoot value. For example: - - ErrorLog "log/error_log" - -Combine the above two directives to obtain the full path of an error log, which is by default /etc/httpd/logs/error_log. This is a symlink to /var/log/httpd/error_log with freshly installed Apache. - -In reality, ErrorLog may point to any arbitrary location on your Linux system. - -#### Custom Error Log with VirtualHost #### - -If you enabled VirtualHost, you can find the error log location of individual VirtualHosts by checking /etc/httpd/conf/httpd.conf (or any file where VirtualHost is defined). Look for ErrorLog inside individual VirtualHost sections. For example, in the following VirtualHost section, an error log is found in /var/www/xmodulo.com/logs/error_log. - - - 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 - - --------------------------------------------------------------------------------- - -via: http://ask.xmodulo.com/apache-error-log-location-linux.html - -作者:[Dan Nanni][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://ask.xmodulo.com/author/nanni -[1]:http://xmodulo.com/configure-fail2ban-apache-http-server.html -[2]:http://xmodulo.com/interactive-apache-web-server-log-analyzer-linux.html -[3]:http://xmodulo.com/sql-queries-apache-log-files-linux.html diff --git a/translated/tech/20150518 Linux FAQs with Answers--What is the Apache error log location on Linux.md b/translated/tech/20150518 Linux FAQs with Answers--What is the Apache error log location on Linux.md new file mode 100644 index 0000000000..c43ac481e7 --- /dev/null +++ b/translated/tech/20150518 Linux FAQs with Answers--What is the Apache error log location on Linux.md @@ -0,0 +1,81 @@ +Linux有问必答——Linux上Apache错误日志的位置在哪里? +================================================================================ +> **问题**: 我尝试着解决我 Linux 系统上的 Apache 网络服务器的错误,Apache的错误日志文件放在[你的 Linux 版本]的哪个位置呢? + +错误日志和访问日志文件为系统管理员提供了有用的信息,比如,为网络服务器排障,[保护][1]系统不受各种各样的恶意活动侵犯,或者只是进行[各种各样的][2][分析][3]以监控 HTTP 服务器。根据你网络服务器配置的不同,其错误/访问日志可能放在你系统中不同位置。 + +本文可以帮助你**找到Linux上的Apache错误日志**。 + +![](https://farm8.staticflickr.com/7664/16958522954_4852ab5ea5_c.jpg) + +### Debian,Ubuntu或Linux Mint上的Apache错误日志位置 ### + +#### 默认的错误日志 #### + +在基于Debian的Linux上,系统范围的Apache错误日志默认位置是**/var/log/apache2/error.log**。默认位置可以通过编辑Apache的配置文件进行修改。 + +#### 自定义的错误日志 #### + +要找到自定义的错误日志位置,请用文本编辑器打开 /etc/apache2/apache2.conf,然后查找以 ErrorLog 开头的行,该行指定了自定义的 Apache 错误日志文件的位置。例如,在未经修改的 Apache 配置文件中可以找到以下行: + + ErrorLog ${APACHE_LOG_DIR}/error.log + +在本例中,该位置使用 APACHE_LOG_DIR 环境变量进行配置,该变量在 /etc/apache2/envvars 中已被定义。 + + export APACHE_LOG_DIR=/var/log/apache2$SUFFIX + +在实际情况中, ErrorLog 可能会指向你 Linux 系统中任意路径。 + +#### 使用虚拟主机自定义的错误日志 #### + +如果在 Apache 网络服务器中使用了虚拟主机, ErrorLog 指令可能会在虚拟主机容器内指定,在这种情况下,上面所说的系统范围的错误日志位置将被忽略。 + +启用了虚拟主机后,各个虚拟主机可以定义其自身的自定义错误日志位置。要找出某个特定虚拟主机的错误日志位置,你可以打开 /etc/apache2/sites-enabled/.conf,然后查找 ErrorLog 指令,该指令会显示站点指定的错误日志文件。 + +### CentOS,Fedora或RHEL上的Apache错误日志位置 ### + +#### 默认的错误日志 #### + +在基于 Red Hat 的Linux中,系统范围的 Apache 错误日志文件默认被放置在**/var/log/httpd/error_log**。该默认位置可以通过修改 Apache 配置文件进行自定义。 + +#### 自定义的错误日志 #### + +要找出 Apache 错误日志的自定义位置,请用文本编辑器打开 /etc/httpd/conf/httpd.conf,然后查找 ServerRoot,该参数显示了 Apache 服务器目录树的顶层,日志文件和配置都位于该目录树中。例如: + + ServerRoot "/etc/httpd" + +现在,查找 ErrorLog 开头的行,该行指出了 Apache 网络服务器将错误日志写到了哪里去。注意,指定的位置是 ServerRoot 值的相对位置。例如: + + ErrorLog "log/error_log" + +结合上面的两个指令,可以获得完整的错误日志路径,默认情况下该路径就是 /etc/httpd/logs/error_log。在全新安装的Apache中,这是一个到 /var/log/httpd/error_log 的符号链接。 + +在实际情况中, ErrorLog 可能指向你 Linux 系统中的任意位置。 + +#### 使用虚拟主机自定义的错误日志 #### + +如果你启用了虚拟主机,你可以通过检查 /etc/httpd/conf/httpd.conf(或其它任何定义了虚拟主机的文件)来找到各个虚拟主机的错误日志位置。在独立的虚拟主机部分查找 ErrorLog。如,在下面的虚拟主机部分,错误日志的位置是 /var/www/xmodulo.com/logs/error_log。 + + + 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 + + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/apache-error-log-location-linux.html + +作者:[Dan Nanni][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:http://xmodulo.com/configure-fail2ban-apache-http-server.html +[2]:http://xmodulo.com/interactive-apache-web-server-log-analyzer-linux.html +[3]:http://xmodulo.com/sql-queries-apache-log-files-linux.html