Multiple vhosts with wildcards?
Igor Sysoev
is at rambler-co.ru
Wed Feb 20 15:25:59 MSK 2008
On Wed, Feb 20, 2008 at 09:46:23AM +0000, Phillip B Oldham wrote:
> At the moment we're using lighttpd, but its proving to be a little flaky
> with php-fcgi. I'd like to know whether its possible to get the
> following set-up working so I can replace lighttpd with nginx.
>
> We use a *lot* of wildcard domains. The subdomains correspond to a
> client, and they have their own areas:
>
> review.*.ourdomain.com
> mail.*.ourdomain.com
> dev.*.ourdomain.com
> *.ourdomain.com
>
> This is pretty trivial to set up in lighttpd:
>
> $HTTP["host"] =~ "^review\.(.*)\.ourdomain\.com" {}
> $HTTP["host"] =~ "^mail\.(.*)\.ourdomain\.com" {}
> $HTTP["host"] =~ "^dev\.(.*)\.ourdomain\.com" {}
> $HTTP["host"] =~ "^(.*)\.ourdomain\.com" {}
>
> Trying to set up something similar in nginx raises problems. This is my
> setup:
>
> server {
> server_name review.it.ourdomain.com review.*.ourdomain.com;
> ...
> }
>
> server {
> server_name dev.it.ourdomain.com dev.*.ourdomain.com;
> ...
> }
>
> but this just throws the following error:
>
> [emerg] 3320#0: invalid server name or wildcard "dev.*.ourdomain.com"
>
> Any idea how I can achieve the result I'm looking for?
> --
Use regex (note "~"):
server {
server_name review.it.ourdomain.com ~^review\..+\.ourdomain\.com$;
...
}
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list