PHP below server root not served

nano nanotek at
Thu Jan 9 11:44:35 UTC 2014

On 9/01/2014 9:55 PM, Francis Daly wrote:
> On Thu, Jan 09, 2014 at 09:23:56PM +1100, nano wrote:
> Hi there,
> 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)$ {
> 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.)

Hi. Thank you for your response. I had previously read the documentation 
you reference but I am afraid I am none the wiser, likely due to my own 
failure to comprehend. Similarly, I am finding it difficult to implement 
your suggestion. Would you please provide an example of this arrangement 
I should have?

I attempted multiple variations of what I believed your instructions 
suggested (nesting \.php$ location inside the /phpmyadmin location); 
such as:

  location ^~ /phpmyadmin {
                 alias       /usr/local/www/phpMyAdmin/;
                 fastcgi_param DOCUEMNT_ROOT /usr/local/www/phpMyAdmin;
                 fastcgi_param PATH_INFO $fastcgi_script_name;

         location ~ \.php$ {
                 fastcgi_pass unix:/var/run/php-fpm.sock;
                 fastcgi_param SCRIPT_FILENAME 
                 fastcgi_param PATH_INFO $fastcgi_script_name;
                 include fastcgi_params;

I implemented many varieties of this location nesting. All resulted in 
the same inability to access the URI: But also 
made the WordPress site ( unavailable. Instead, it 
presented a dialog offering to download the 'application/octet-stream'.

Please provide the configuration you suggest. Thank you.


More information about the nginx mailing list