Apache 如何解析error_log 的路径?

And*_*302 2 logs apache-httpd

在我httpd.conf所在的地方/etc/httpd/conf/httpd.conf有一行:

ErrorLog logs/error_log
Run Code Online (Sandbox Code Playgroud)

但是日志文件的路径是: /var/log/httpd/error_log

Apache Webserver 如何解析 error_log 文件的路径?

And*_*302 6

找到了解决办法:

如果 ErrorLog 的路径不是以“/”开头,那么ServerRoot(也在 httpd.conf 中)的路径被添加到前面。
ServerRoot在我的配置是/etc/httpd
所以logs/error_log改为/etc/httpd/logs/error_log.

路径/etc/httpd/logs/error_log是到的相对链接../../var/log/httpd 如果将此相对路径转换为绝对路径,则结果为:

/var/log/httpd/error_log
Run Code Online (Sandbox Code Playgroud)