User account menu

  • Log in
BXTra.net

Breadcrumb

  • Home
  • Articles
  • [HOW-TO] Install mod_rpaf for Apache 2.2

[HOW-TO] Install mod_rpaf for Apache 2.2

By BXTra | 11:59 PM PST, Sun February 13, 2011
Nginx
DirectAdmin
CentOS
Apache

When you do a reverse proxy in which Nginx will be the one who listen the traffic and forward anything needs to be process through PHP to Apache. With this, Apache will always receive an IP from Nginx server (or I should say localhost / 127.0.0.1 / local IP), not the real IP that user uses. In order to let Apache knows what is real user IP, we need to install mod_rpaf.

Just copy and paste code below into SSH :

wget http://stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz
tar xvfz mod_rpaf-0.6.tar.gz
cd mod_rpaf-0.6
sed -ie 's/apxs2/apxs/' Makefile
make rpaf-2.0
make install-2.0

After compiled, do some configuration as below :

LoadModule rpaf_module /usr/lib/apache/mod_rpaf-2.0.so

<IfModule mod_rpaf.c>
RPAFenable On
RPAFsethostname On
RPAFproxy_ips 127.0.0.1
RPAFheader X-Forwarded-For
</IfModule>

RPAFproxy_ips can be multiple IP address and it's IP from your reverse proxy.

RPAFproxy_ips 127.0.0.1 xxx.xxx.xxx.xxx

 

Update (2011.02.15) :

If, for some reason, you tried it and it didn't work. Try to recompile and restart Apache again. After I setup above configuration, it worked fine for a day until I found that it no longer worked. I didn't say it will stop working by itself. I believe it went bad because I did restart Apache service very often after set this up. ( To test Nginx :P )

Test Configuration :
1. CentOS 5.4 / 5.5 - 64 bits
2. DirectAdmin 1.37 - With Custombuild 1.2
3. Apache 2.2.17
4. mod_rpaf 0.6

Source :
- http://maxgarrick.com/reverse-proxy-with-nginx/
- http://stderr.net/apache/rpaf/

About text formats
  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Umpol

13 years 9 months ago

Permalink

Some problem

Hello, I follow your guide installation fine. apache can start fine. but after I view "server-status" page from "mod_status" I found all client ip is serverip. How to solve this problem ? (I applied your tutorial nginx proxy) Regards, Metee
  • Reply

Denis TRUFFAUT

13 years 4 months ago

Permalink

Full path replacement

Sometimes, the apxs binary is not known and its full path is required.
APACHE_MOD_RPAF_VERSION='0.6'
cd /usr/local/src
sudo wget -O    mod_rpaf-$APACHE_MOD_RPAF_VERSION.tar.gz "http://stderr.net/apache/rpaf/download/mod_rpaf-$APACHE_MOD_RPAF_VERSION.tar.gz"
sudo tar  -xvzf mod_rpaf-$APACHE_MOD_RPAF_VERSION.tar.gz
sudo rm   -rf   mod_rpaf-$APACHE_MOD_RPAF_VERSION.tar.gz
cd              mod_rpaf-$APACHE_MOD_RPAF_VERSION

# Fix Makefile
sudo sed -ie 's/\$(APXS)/\/usr\/local\/apache\/bin\/apxs/' Makefile
sudo sed -ie 's/\$(APXS2)/\/usr\/local\/apache\/bin\/apxs/' Makefile

sudo make rpaf-2.0 && sudo make install-2.0 && cd /usr/local/src
sudo rm   -rf   mod_rpaf-$APACHE_MOD_RPAF_VERSION
  • Reply
  • Add new comment

  • Will the router get the Openvpn as a client option?
    6 years ago
  • cancellation
    6 years 1 month ago
  • Router ASUS RT-N12 D1 tomatoes passwort falsch
    7 years 8 months ago
  • WPS button = 30/30/30 hard reset button
    7 years 9 months ago
  • Save my day!
    8 years 3 months ago
  • How to
    8 years 6 months ago
  • Can i still access my modem (the one with the ISP provided)?
    8 years 6 months ago
  • A saving step!
    8 years 10 months ago
  • Problem with Asus n12e-c1
    8 years 11 months ago
  • don't use Hostgator
    9 years 2 months ago

© 2007 - 2023 BXTra.net. All Rights Reserved. 
Certain other content, photos and artwork displayed on BXTra.net are protected by copyright and are the property of their respective owners.

Privacy Policy