Apache2 决定忽略 ErrorLog 位置。如何修复?

Apache2 决定忽略 ErrorLog 位置。如何修复?

我的apache2.conf文件包含行ErrorLog /var/www/logs/error_logCustomLog /var/www/logs/access_log common。但是,我只能在那里收到服务器关闭/重启通知。所有其他日志都会发送到原始位置(/var/log/apache2)。我花了一天时间盲目调试,直到我解决了这个问题。如何将所有日志发送到我想要的位置?

该(压缩)apache2.conf文件看起来与此类似(没有模块和目录):


LockFile ${APACHE_LOCK_DIR}/accept.lock
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
AccessFileName .htaccess
DefaultType None
HostnameLookups Off
ErrorLog /var/www/logs/error_log
LogLevel debug
Include mods-enabled/*.load
Include mods-enabled/*.conf
Include httpd.conf
Include ports.conf
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /var/www/logs/access_log common
Include conf.d/
Include sites-enabled/

ServerName 158.132.10.185
ServerRoot /var/www
DocumentRoot /var/www
AddType application/x-httpd-cgi .cgi

...

答案1

所有其他日志是什么意思?您可能已经定义了许多虚拟主机,这些其他日志属于它们。因此,您应该在相应的VirtualHost配置部分中根据每个虚拟主机设置日志文件位置。

相关内容