How to setup nginx to make php works in site subdirectories

Francis Daly francis at
Sun Feb 12 12:59:35 UTC 2012

On Sun, Feb 12, 2012 at 06:33:09AM -0500, dimentiy wrote:

Hi there,

> Scripts in site's root are processed, but in subdirectories are not (

Using your configuration, I'm unable to reproduce your reported output.

There are some tidy-up fixes that could be done to your configuration,
but what you have should be working already.

I suspect that either it *is* working but your browser cache is hiding
that from you; or you have an extra location{} block that means that your
"\.php$" one isn't being used.

Suggestion: create a file /var/www/nginx-default/
with the contents:


and look at the result of getting That should
remove the "browser cache" possibility.

If it is still not what you expect, then something like the debug log
should show you which location{} is being used for this request.

Good luck with it,

Francis Daly        francis at

More information about the nginx mailing list