LogFormat apache 2.4不起作用

我试图在apache2.4中configurationmod_remoteip与代理squid在一个单独的服务器,但在access.log中的IP仍然是代理的IP。 我使用这个https://trick77.com/apache2-2-4-logging-remote-ip-address-using-mod_remoteip/

实际上,我发现在/etc/apache2/apache2.conf ,该命令

 LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined 

即使我改变文本或删除它,也不要更改access.log的格式。

有人可以帮忙吗?

 LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined 

LogFormat只为日志格式创build“昵称”。 实际使用的格式是由…定义的

 CustomLog ${APACHE_LOG_DIR}/access.log combined 

CustomLog定义了日志的存储位置和格式。

我发现使用昵称combined不起作用,因为它已经被采用。 所以这个工作:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" %D" myawesomeformat

CustomLog ${APACHE_LOG_DIR}/access.log myawesomeformat