Hostname in Root directive.
francis at daoine.org
Fri Jul 19 15:41:48 UTC 2013
On Fri, Jul 19, 2013 at 10:55:57AM -0400, David | StyleFlare wrote:
> I know this may not be safe, but how can I set the hostname in the root
> ie; root /www/$hostname/static;
By using a variable, just like you've done there.
Two things you need to decide:
what exact variable do you want to use? (There's a list of core-module
pre-defined variables at
and do you want to accept whatever that variable happens to hold, or do
you want to use something like a map (http://nginx.org/r/map) to set it
to a default value if it doesn't have a "safe" value, where you define
"hostname" might be $http_host, or $host, or $server_name (with increasing
amounts of trust), or maybe something else entirely.
Francis Daly francis at daoine.org
More information about the nginx