Conversion of PHP single machine setup to nginx/php residing on different boxes

Francis Daly francis at
Wed Jun 6 13:34:24 UTC 2012

On Wed, Jun 06, 2012 at 04:18:10PM +0300, Johannes Graumann wrote:

Hi there,

> >         location ~ \.php$ {
> >                 try_files $uri =404;

try_files refers to local files only.

You probably don't want it here at all.

> >                 fastcgi_pass;
> >                 fastcgi_index  index.php;
> >                 fastcgi_param  SCRIPT_FILENAME  

SCRIPT_FILENAME is a parameter that the fastcgi server will read, and
it will expect it to refer to a file on its filesystem that it should
load and process.

So: if the client requests the url /one/two.php, what file on the server do you want that to correspond to? (From the perspective
of the fasctcgi server, in case it is chroot'ed.)

Make SCRIPT_FILENAME be that filename.

All the best,

Francis Daly        francis at

More information about the nginx mailing list