native variable for one level above $document_root ?

Francis Daly francis at daoine.org
Sun Mar 8 01:59:05 UTC 2015


On Sat, Mar 07, 2015 at 04:26:00PM -0500, George wrote:

Hi there,

> At the nginx vhost level, is there a native nginx value similar to
> $document_root for one directory level above $document_root ?

Probably not; but you can use "map" to make your own.

For example:

  map $document_root $the_thing_that_you_want {
    default "";
    ~(?P<it>.*)/. $it;
  }

http://nginx.org/r/map

Then use $the_thing_that_you_want.

Be aware of the time at which the variable gets its value.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list