Is it possible using multiple directive on different root location? (Without Symlinks)

Francis Daly francis at
Thu May 3 22:43:09 UTC 2012

On Thu, May 03, 2012 at 05:59:54AM -0700, antituhan wrote:

Hi there,

> How about php directive cliff ? I still get errors, my full directive like
> this

The important part here is that your top-level location{} directives are

location /
location /cdnize/
location ~ .php$

Each request will be handled by exactly one of those blocks.

> And i have a index.php on /home/antituhan/public_html to be triggered by
> another upstream outsite with
> and it says not
> found. Is my .php directive wrong ?

The request for /cdnize/index.php would be handled by the "location ~
.php$" block.

In there, you have

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

and $document_root is "root", which is inherited from the

root /home/antituhan/static;

directive at server level. So this request ends up (with the fastcgi
server) looking for the file /home/antituhan/static/cdnize/index.php,
which is presumably not what you want.

Probably you'll want to look at nesting a php location inside the /cdnize/
one. And then moving the current php location to be inside the / one.

So you will probably need to have two or more locations that handle php,
which each use a fastcgi_pass directive.

I'm sure there are recent examples of this set-up on the mailing list.

Good luck with it,

Francis Daly        francis at

More information about the nginx mailing list