Arbitrarily slicing $server_name into subdomains?
lists at ruby-forum.com
Wed Jan 6 22:24:40 MSK 2010
Hi there, hope all are well!
I'd like to match a wildcard DNS name, pointing to an nginx virtual
host, such that an arbitrary level of subdomains maps to an arbitrary
level of directories, in a manner I specify.
It's straightforward to do this for a fixed level of
subdomains/directories using a server_name regex, for example:
set $my_host $2/$1;
which gives me project.client.myserver.net ->
.../myserver.net/client/project/... - but the whole point of using
wildcards like this is that I don't want to keep adding new configs.
Is it possible to do this, perhaps using the perl config module? Or
maybe just a smarter regex?
Very grateful for any suggestions.
Posted via http://www.ruby-forum.com/.
More information about the nginx