Apache - 如何記錄真實IP
Published in:2024-01-04 | category: Apache


下載模組



wget https://github.com/ttkzw/mod_remoteip-httpd22/archive/refs/heads/master.zip

unzip mod_remoteip-httpd22-master.zip

cd mod_remoteip-httpd22-master

apxs -i -c -n mod_remoteip.so mod_remoteip.c


修改設定檔 (在最下面新增模組)

LoadModule remoteip_module modules/mod_remoteip.so


修改紀錄 LOG的格式 (修改為以下)

LogFormat "%h %{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common

LogFormat "%h %a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio



Prev:
Linux - 將 CentOS-home 硬碟空間轉移至 CentOS-root 底下
Next:
Github Action - 實現CI/CD自動部署至 Render