Multiple vhosts with wildcards?

Phillip B Oldham phill at
Wed Feb 20 12:46:23 MSK 2008


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:


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 

server {
server_name review.*;

server {
server_name dev.*;

but this just throws the following error:

[emerg] 3320#0: invalid server name or wildcard "dev.*"

Any idea how I can achieve the result I'm looking for?

*Phillip B Oldham*
The Activity People
phill at <mailto:phill at>



This e-mail and its attachments are intended for the above named 
recipient(s) only and may be confidential. If they have come to you in 
error, please reply to this e-mail and highlight the error. No action 
should be taken regarding content, nor must you copy or show them to anyone.

This e-mail has been created in the knowledge that Internet e-mail is 
not a 100% secure communications medium, and we have taken steps to 
ensure that this e-mail and attachments are free from any virus. We must 
advise that in keeping with good computing practice the recipient should 
ensure they are completely virus free, and that you understand and 
observe the lack of security when e-mailing us.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: phill.vcf
Type: text/x-vcard
Size: 261 bytes
Desc: not available
URL: <>

More information about the nginx mailing list