proxy_pass to Apache config not working like fastcgi_pass

Michael Shadle mike503 at gmail.com
Sun Dec 6 08:42:34 MSK 2009


On Sat, Dec 5, 2009 at 9:28 PM, nerdgrind <nginx-forum at nginx.us> wrote:

> I run Red Hat Enterprise Linux 5 server. If I were to install PHP-FPM, which patches the PHP package, it would be replaced when PHP is updated on the next yum update. I have spawn-cgi installed, and can run it only from the command line as such:

well you don't run php from an rpm package and php-fpm on top of it.
you pick one or the other :p

if you are really glued to using php from a repository than spawn-fcgi
is your better choice for now

> /usr/local/bin/spawn-fcgi -a 127.0.0.1 -p 9001 -C 5 -u apache -g apache -f "/usr/bin/php-cgi /maxconns=1024 /maxreqs=1024" -P /var/run/fastcgi-php.pid

if you're having issues with spawn-fcgi (which i can't tell if you are
or not) i would check if this is legit "/usr/bin/php-cgi
/maxconns=1024 /maxreqs=1024" - i was not aware that php-cgi took
command line arguments like a windows command (but maybe the behavior
has changed and i just don't pay attention because i don't need to)


> Apache can run PHP reliably on heavy loads, and it gets updated automatically on a yum update, so for me it works, and it automatically restarts if the sever does, because the init script works.

Apache can easily choke on heavy loads. Been there, done that. As have
many people here. I'd cite benchmarking but it seems like everyone's
got a page of benchmarks out there and Apache chokes, Lighty chokes
sometimes, nginx never chokes.

> I've read that under heavy load Apache can handle PHP much more reliably than fastcgi as well, which is what I'm after.

Where?

> Apache running as a backend in the configuration I cited above uses as much or less memory and CPU cycles as fastcgi, so the only issues for me are reliability, and the ability to have an init script that works.

Where?

> I am also concerned about SEO: http://wordpress.org/extend/plugins/nginx-compatibility/

I run wordpress with full SEO (I assume "friendly URLs") as do tons of
people on this list with a single line of nginx configuration code. I
have been for years now (well, the new single line option happened
somewhere along the way, before that it was 3 lines)

See: http://michaelshadle.com/2009/03/19/finally-using-nginxs-try-files-directive/

> My config handles different files in different ways as you can see. I have several high traffic blogs, and they have very specific needs.

You can probably simplify things a lot. Use includes for redundant
portions. I have one for expires headers for graphics/assets. etc.



More information about the nginx mailing list