Ivorde Unix/Linux/Database/Web/Mail Forum

View unanswered posts
View active topics
It is currently Sat Feb 04, 2012 10:24 pm


This forum is dedicated to Apache, Nginx, Lighttpd, Squid and other HTTP transport protocol related software

Bookmark this article:

Author Message
designeru
  Post  Post subject: Nginx + apache (for PHP) with real IP addresses in logs  |  Posted: Tue May 18, 2010 4:49 pm

Joined: Thu Dec 31, 2009 11:44 pm
Posts: 10

Offline
Save on Delicious
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 59 times
Top
Display posts from previous:  Sort by  
Print view

Topics related to - "Nginx + apache (for PHP) with real IP addresses in logs"
 Topics   Author   Replies   Views   Last post 
There are no new unread posts for this topic. Converting PhpBB-SEO Apache RewriteRule to Nginx rewrite

debuser

0

18420

Tue Feb 23, 2010 12:00 pm

debuser View the latest post

There are no new unread posts for this topic. Apache to Nginx Server parameters translation with php function

debuser

0

1547

Thu Aug 26, 2010 2:47 pm

debuser View the latest post

There are no new unread posts for this topic. Apache 2.2 installation of mod_rewrite module without recompiling whole apache

debuser

0

5792

Tue Mar 23, 2010 6:22 pm

debuser View the latest post

There are no new unread posts for this topic. Nginx + php-fpm setting php upload_max_filesize and other php values per vhost

mandrei99

0

99

Mon Jan 02, 2012 4:04 pm

mandrei99 View the latest post

There are no new unread posts for this topic. Starting nginx: [emerg]: directive "rewrite" is not terminated by ";"

debuser

0

1095

Tue Feb 23, 2010 1:05 pm

debuser View the latest post

 

Who is online
Users browsing this forum: No registered users and 0 guests
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
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 + 2 hours [ DST ]

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
DAJ Glass 2 template created by Dustin Baccetti

phpBB SEO