我需要修改 Apache 中的 LogFormat 以添加X-Forwarded-For
标头并记录客户端的真实 IP。我尝试在httpd.conf文件中编辑该内容,但随后发现 LogFormat 的两个单独部分。所以我不确定它们是否重复,是否应该删除其中任何一个,并且我不知道要编辑其中哪些,或者应该全部编辑。我需要一些建议。
这是第一部分:
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog "logs/access_log" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
</IfModule>
Run Code Online (Sandbox Code Playgroud)
第二部分:
<IfModule mod_log_config.c>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i …
Run Code Online (Sandbox Code Playgroud)