PHP below server root not served

Francis Daly francis at
Thu Jan 9 10:55:31 UTC 2014

On Thu, Jan 09, 2014 at 09:23:56PM +1100, nano wrote:

Hi there,

> The WordPress site, however, is served without error. Therefore, nginx 
> is refusing to serve PHP from outside of the server document root. 

nginx doesn't serve php.

nginx tells the fastcgi server what you configure it to tell.

(That's an important difference from what Apache does.)

> Please see the following configuration:

One request is handled in one location.

For this request, the one location that you want to be used is not the
one that nginx actually uses.

>         location / {
>         location ~ \.php$ {
>         location /phpmyadmin/ {
>         location ~ ^/phpmyadmin/(.*\.php)$ {

> I am obviously lacking some required configuration. Perhaps in 
> nginx.conf, php-fpm.conf, or php.ini. Could someone please advise me of 
> my error and how to correct it? Thank you.

A request for /phpmyadmin/index.php will be handled in the second location
above, not the fourth.

Re-arrange the config file.

(I'd suggest using "location ^~ /phpmyadmin/", and inside that using
"location ~ \.php$"; but just re-ordering the regex blocks that you have
should cause the location that you want to be chosen.)

Francis Daly        francis at

More information about the nginx mailing list