$document_root variable not working

Francis Daly francis at daoine.org
Thu May 24 22:42:38 UTC 2012

On Thu, May 24, 2012 at 11:45:07PM +0200, Thomas Krause wrote:

Hi there,

> The problem is the config line
>      set $php_root $document_root;
> When I replace it with
>      set $php_root /usr/local/www/nginx;
> everything is okay.

You've found a configuration that works for you, so there is no need to
change anything.

If you choose to change things, I would suggest removing the
if-within-location, and removing the top-level regex location -- and
duplicating the php configuration.

But that's mostly for future convenience.

> I found in the documentation,
> that $document_root should contain the value
> of "root", but obvious it isn't.

Why do you think that it isn't?

What do you think "root" is set to within your "location ~ \.php$" block?

(Hint: the configuration you have shown does *not* show what it is set to.)

> Any ideas whats wrong?


is my guess.

All the best,

Francis Daly        francis at daoine.org

More information about the nginx mailing list