Single server with multiple hierarchies

Francis Daly francis at
Wed Aug 1 19:08:11 UTC 2012

On Wed, Aug 01, 2012 at 07:37:10AM -0400, yashgt wrote:

Hi there,

> My directory structure is:
> /usr/share/nginx/www
> 	/magento/current <- This is my application
> 	/phpmyadmin
> I changed the root of the server to
> /usr/share/nginx/www/magento/current.

You changed the server{}-level "root" directive, so that any location{}
that does not include its own "root" directive will use that one.

> I would like to configured phpmyadmin such that it is accessible as
> http://myserver/phpmyadmin/index.php.
> Please note that the root of my application is different than the root
> of phpmyadmin and both are to be served from the same server.

A http request comes in, and is processed by exactly one location. An
internal rewrite may cause it to then be processed by one other
location. This can happen again.

> If I create a location with ^~ /phpmyadmin/ can I set a root in it? Will
> I have to do something to pass the index.php to FCGI. Will this have to
> be done in the location directive?

Yes to each. You'll probably want to nest locations, like

  location ^~ /phpmyadmin/ {
    #root and other directives
    location ~ php {
      #php-relevant directives

Good luck with it,

Francis Daly        francis at

More information about the nginx mailing list