Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Sun Oct 20, 2019 1:08 pm


Username:
Subject:
Message body:
Enter your message here, it may contain no more than 60000 characters. 

Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
Font size:
 
Font colour
Options:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Disable BBCode
Disable smilies
Do not automatically parse URLs
Confirmation code
Confirmation code:
In an effort to prevent automatic submissions, we require that you enter both of the words displayed into the text field underneath.
     

Topic review - Nginx + apache (for PHP) with real IP addresses in logs
Author Message
Post subject: Nginx + apache (for PHP) with real IP addresses in logs  |  Post Posted: Tue May 18, 2010 9:49 am
I was trying to get nginx to work with apache 2.2.15. The idea is that nginx will ofer the static content and apache the PHP content.
Very easy to do and a lot of documentation is available over the internet on how to do it. However, i encountered some issue when i was trying to get nginx to send the real IP address of the visitor to the apache server and not the localhost ip (127.0.0.1).

The solution came with the mod_rpaf module for apache. You can download it from here. In case that website will go down for some reasons, i've attached to this post the latest available version of this module (released 01-Jan-2008 22:42 - that's more than 2 years ago).

Here is how my configuration looks like:

1. Apache2 conf (related with mod_rpaf, the rest you can google for help)
Code:
LoadModule rpaf_module modules/mod_rpaf-2.0.so
RPAFenable On
RPAFsethostname On
RPAFproxy_ips 127.0.0.1 10.255.254.1
RPAFheader X-Forwarded-For

Note: I have both 127.0.0.1 and 10.255.254.1 ips configured as local IP. Most probably you will have only 127.0.0.1...

2. nginx conf (related with proxy redirection to apache2)
Code:
in the server section
            location ~ \.php$ {
                    proxy_pass http://127.0.0.1:82;
            }

in the http section
                    proxy_redirect            off;
                    proxy_connect_timeout     60;
                    proxy_send_timeout        60;
                    proxy_read_timeout        60;
                    proxy_ignore_client_abort off;
                    proxy_intercept_errors    on;
                    proxy_ignore_headers   Expires Cache-Control;
                    proxy_set_header        Host            $host;
                    proxy_set_header        X-Real-IP       $remote_addr;
                    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;


Attachments:
File comment: mod_rpaf-0.6.tar - please download the sources from the oficial site. This is a very old version.
mod_rpaf-0.6.tar.gz [7.51 KiB]
Downloaded 581 times
Jump to:  
News News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO