nginx: server_name wildcard not working

Igor Clark igor at pokelondon.com
Wed Jun 27 15:01:13 MSD 2007


Hi there,

We have developers working with various versions of web servers and  
programming languages, for different clients and environments.
I'm trying to do this:

         server {
                 listen  80;
                 server_name     apache1 *.apache1.*.mydomain.com;
                 location / {
                         proxy_pass      http://127.0.0.1:4000;
                 }
         }

         server {
                 listen  80;
                 server_name     apache2 *.apache2.*.mydomain.com;
                 location / {
                         proxy_pass      http://127.0.0.1:5000;
                 }
         }

         server {
                 listen  80;
                 server_name     litespeed *.litespeed.*.mydomain.com;
                 location / {
                         proxy_pass      http://127.0.0.1:6000;
                 }
         }

	server {
		listen 80;
		server_name    php5  *.php5.*.mydomain.com;
		location ~ \.php$ {
			fastcgi_pass   127.0.0.1:9000;
			fastcgi_index  index.php;
			[...]
		}
	}

With this configuration, the host dev1.mydomain.com could serve:

	http://site1.apache1.dev1.mydomain.com/	-->	apache1
	http://site1.apache2.dev1.mydomain.com/	-->	apache2
	http://site1.litespeed.dev1.mydomain.com/	-->	litespeed
	http://site1.php5.dev1.mydomain.com/		-->	php5/fcgi, nginx

the host dev2.mydomain.com could serve:

	http://site1.apache1.dev2.mydomain.com/	-->	apache1
	http://site1.apache2.dev2.mydomain.com/	-->	apache2
	http://site1.litespeed.dev2.mydomain.com/	-->	litespeed
	http://site1.php5.dev2.mydomain.com/		-->	php5/fcgi, nginx

and they could have identical configuration. This is important  
because I want to keep the second wildcard (for "dev1/dev2"), so that  
I can make a machine image to install on new computers.

But the wildcard doesn't work.

With nginx 0.6.0 I get this error:

	2007/06/27 11:36:07 [emerg] 27966#0: invalid server name or wildcard  
"*.apache1.*.mydomain.com" on 0.0.0.0:80

With 0.5.26 the configuration test "nginx -t -c nginx.conf" is OK but  
it doesn't work - all requests are forwarded to apache 1, whatever  
host name is requested.

Does anybody know whether this is possible?

Thanks very much for your help.

Best wishes,
Igor Clark.

--
Igor Clark // POKE // 10 Redchurch Street // E2 7DD // +44 (0)20 7749  
5355 // www.pokelondon.com

We've gone sub-zero with the TopGear Cool Wall: http:// 
www.topgear.com/coolwall/


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20070627/76ef423e/attachment.html>


More information about the nginx mailing list