Best way to use PHP with nginx?
grails at jmsd.co.uk
Fri Nov 13 17:42:02 MSK 2009
Nuno Magalhães wrote:
> On Fri, Nov 13, 2009 at 13:45, John Moore <grails at jmsd.co.uk> wrote:
>> I have come across a handful of different methods detailed on the Internet
>> for getting PHP running with nginx, but haven't come across the 'definitive'
>> version. What method do the regular nginx users on here favour?
> Did you search? You'll need a FastCGI daemon or you can proxy it to
> apache's mod_php or something else. There's no definite method, so
> it's your pick. On Debian the php-cgi package serves me just fine.
Yes, I searched. In fact, I've been running a PHP/nginx combination for
some time, using the technique outlined here:
It works fine, although I've not tested it under load. But I came across
this posting, which suggested a more efficient way to do it:
He says "There are dozens of HOWTOs for configuring nginx to direct .php
files requests to FastCGI, but only a few covering the topic of running
the PHP FastCGI backend. None of them covers the correct way, though.
Let me show you how to get it right…PHP CGI binary is perfectly able
running a FastCGI interface by itself. There is no need to run it with
an external wrapper. No need to install anything more than the PHP itself."
When I tried a while back, I couldn't get this working, I can't exactly
recall why, but I was planning on giving it another go unless I came
across another technique which I knew was widely adopted with success,
hence my question.
I suppose I should really have named the topic "Best way to use PHP with
nginx under Ubuntu" because that's what I'm most interested in.
More information about the nginx