查看完整版本: 透過Apache mod_rpaf 來得知 reverse proxy server訪客的真實IP


lancer 2011-12-11 16:40

透過Apache mod_rpaf 來得知 reverse proxy server訪客的真實IP

何謂reverse proxy?就是反向代理,網站的訪客越多越有有效果,省去90%的apache process,等於也節省了相當多的資源,若是reverse proxy再加上cache的功能,那麼網站的速度真的會大幅度提升<br><br><img src="http://weblogs.asp.net/blogs/owscott/ReverseProxy_62C8B69C.jpg" border="0" alt=""><br><br>由於大家都只對revere proxy連線,實際存取apache的就只有reverse proxy而已,若是不透過reverse proxy,apache的log可以清楚的紀錄每一個連線的ip,但是透過了reverse proxy之後,所有瀏覽紀錄會變成只剩下一個..雖然說reverse proxy也可以留下紀錄,但是遇到有問題要比對時就相當麻煩了,所以還是希望apache可以記錄到原始的ip。<br><br>這時候可以安裝mod_rpaf的模組,來達到透過reverse proxy也可以得到真實ip的功能~~<br><br>1. Retrieve and Extract mod_rpaf packages:<br>[quote]<br># cd /usr/local/src<br># wget <a href="http://stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz" target="_blank">http://stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz</a><br># tar xzvf mod_rpaf-0.6.tar.gz<br># cd mod_rpaf-0.6<br>[/quote]<br><br>2. Build and install mod_rpaf<br>[quote]<br># apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c<br>[/quote]<br><br>3. Add mod_rpaf to Apache configuration<br>[quote]<br># vi /etc/httpd/conf/httpd.conf<div><br>- Find the “LoadModule” list (near the top)<br>- Add the following lines at the bottom of the “LoadModule” list:<br><br><div>LoadModule rpaf_module modules/mod_rpaf-2.0.so</div><div># mod_rpaf Configuration</div><div>RPAFenable On</div><div>RPAFsethostname On</div><div>RPAFproxy_ips 127.0.0.1 10.0.0.1</div><div>RPAFheader X-Forwarded-For<br>[/quote]<br></div><div><br></div><div>Where “127.0.0.1 10.0.0.1″ is, add your proxy server IP address(es).
This will ensure that mod_rpaf checks for the X-Forwarded-For header
from these hosts only.</div><div><br></div><div>4. Finish</div><div>Restart Apache for the changes to take effect</div><div>#service httpd restart</div><div><br></div><div><h2>5. Troubleshooting</h2>
<p>The following dependencies may need to be installed before installing mod_rpaf:</p>
<p>httpd-devel, gcc</p>
<p>They can be installed using the following commands:</p><p>[quote]</p><p>#yum install httpd-devel gcc</p><p>[/quote]</p><p><br></p><p>這樣就可以囉~~</p></div></div>
頁: [1]
查看完整版本: 透過Apache mod_rpaf 來得知 reverse proxy server訪客的真實IP