Apache通過mod_rpaf組件記得訪客IP
很多朋友為了獲得訪客IP,經(jīng)常會(huì)使用一些工具。這里告訴大家一個(gè)方法,只要通過一個(gè)組件就可以實(shí)現(xiàn)。那就是mod_rpaf,mod_rpaf是apache的一個(gè)模塊。馬上告訴大家實(shí)現(xiàn)方法。宇塵網(wǎng)絡(luò)幫助中心域名知識(shí)|虛擬主機(jī)知識(shí)|VPS主機(jī)知識(shí)|服務(wù)器知識(shí)|網(wǎng)站建設(shè)知識(shí)|網(wǎng)絡(luò)推廣
下載:搜索并下載mod_rpaf-0.6.tar.gz壓縮包
解壓:tar xvfz mod_rpaf-0.6.tar.gz
進(jìn)入目錄:cd mod_rpaf-0.6
安裝:/usr/local/apache/bin/apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c
安裝好了之后,需要對(duì)httpd.conf文件進(jìn)行配置。
仿牌空間、香港月付空間、韓國月付空間、日本月付空間、荷蘭VPS、香港VPS
在httpd.conf加入如下代碼:
RPAFenable On
RPAFsethostname On
RPAFproxy_ips 127.0.0.1
RPAFheader X-Forwarded-For
加載模塊代碼:
LoadModule rpaf_module modules/mod_rpaf-2.0.so
美國月付空間、月付美國空間、美國VPS、美國服務(wù)器租用
并定義日志格式
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" varnishcombined
以后可以使用如下代碼啟用此格式的日志
CustomLog "/home/wwwlogs/$domain.log" varnishcombined
更多技術(shù)知識(shí),更多網(wǎng)絡(luò)服務(wù),盡在宇塵網(wǎng)絡(luò)。我們的成長,離不開你們的支持,宇塵網(wǎng)絡(luò),歡迎您的訪問。