Getting ip address from fastcgi for Wordpress plugin

I am running a Redhat EL5 server using Nginx 0.8.54 on the frontend,
with Apache 2.2.3 on the backend and mod_rpaf to forward the IP address
to be used in filtering spam from Wordpress comments using the Spam Free
Wordpress plugin. (http://www.toddlahman.com/spam-free-wordpress/)

I would like to use fastcgi to serve PHP, but I am not aware of any way
for fastcgi to forward the visitor’s IP address like mod_rpaf does for
Apache for use by my Wordpress plugin.

I don’t currently use mod_fastcgi to connect to an external fastcgi
process like spawn-fcgi because I can’t get it to work, or php-fpm
because I cannot find the proper php-common rpm and other dependency rpm
files I need to connect memcached and other stuff.

Does anyone have a solution to this? If so could you share your complete
configuration files from Nginx, and Apache, or the fastcgi configuration
outside either of these applications? I am open to any and all
suggestions, but appreciate complete config examples to save time.

Thank you.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,186497,186497#msg-186497

Hello!

On Mon, Mar 28, 2011 at 10:21:31PM -0400, toddlahman wrote:

I am running a Redhat EL5 server using Nginx 0.8.54 on the frontend,
with Apache 2.2.3 on the backend and mod_rpaf to forward the IP address
to be used in filtering spam from Wordpress comments using the Spam Free
Wordpress plugin. (http://www.toddlahman.com/spam-free-wordpress/)

I would like to use fastcgi to serve PHP, but I am not aware of any way
for fastcgi to forward the visitor’s IP address like mod_rpaf does for
Apache for use by my Wordpress plugin.

In fastcgi visitor’s ip address is always passed to application
with appropriate fastcgi params. Bundled fastcgi_params file have
them properly set:

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;

Maxim D.

With my current configuration below the IP address is not appearing
properly in Wordpress.

In the fastcgi.conf I have:

fastcgi_param REMOTE_ADDR $remote_addr;

In the nginx.conf I have:

upstream php {
server 127.0.0.1:9000;
}

location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
include fastcgi.conf;
fastcgi_intercept_errors off;
fastcgi_pass php;
}

cgi.fix_pathinfo = 0; in php.ini

With this I got a blank page when submitting a comment.

I tried adding

    fastcgi_pass_header Host;
    fastcgi_pass_header X-Real-IP;
    fastcgi_pass_header X-Forwarded-For;

Now I get 502 Bad Gateway (Nginx).

What am I missing?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,186497,186583#msg-186583

Was able to get php-fpm installed on the server from the remi repo.
Everything works fine now with the same configuration above.

http://blog.famillecollet.com/post/2010/09/27/PHP-FPM-and-NGINX

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,186497,186824#msg-186824

I failed to see the php-cgi process wasn’t running when I sent the last
message. I am still getting a blank page, not 502 bad gateway.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,186497,186584#msg-186584