root works, alias doesn't

Valentin V. Bartenev vbart at nginx.com
Tue Oct 1 13:55:03 UTC 2013


On Sunday 29 September 2013 23:20:35 B.R. wrote:
[...]
> ​For​
> 
> ​what you wish to do, you might try the following:
> 
> set $rootDir /var/www/localhost/htdocs
> root $rootDir/;
> location / {
>     alias $rootDir/webalizer/;
> }
> 
> alias is meant for exceptional overload of root in a location block, so I
> guess its use here is a good idea.​
> However, there seems to be no environmental propagation of some $root
> variable (which may be wanted by developers to avoid confusion and unwanted
> concatenation of values in the variables tree).
[..]

nginx is not trying to be a template engine.
http://nginx.org/en/docs/faq/variables_in_config.html

  wbr, Valentin V. Bartenev



More information about the nginx mailing list