WildCard domains : how to treat IP Address and Specific Domains differently from Failover/Wildcard Domains ?

Jonathan Vanasco nginx at 2xlp.com
Sun Mar 3 19:58:25 UTC 2013


> server {
>    listen       80;
>    listen       IP:80;
>    server_name  example.com;
>    # site A
> }
> 
> server {
>    listen  80   default_server;
>    # site B
> }
> 
> "listen 80/server_name  example.com" route all requests to example.com to site A.
> "listen IP:80" routes all requests to IP:80 to site A.
> Anything else is routed to default server of 80 port, i.e. to site B. 

Thank you Igor.

Unfortunately, that's not what I needed.  I don't necessarily know the IP address(es) on these machines.  This is part of an automated deployment.

Server A:
	Specific Domain Name
	any IPs

Server B
	any domain names


Francis-

Thank you for this bit -- 

> 	   server {
> 	     server_name example.com;
> 	     server_name ~^[0-9.]*$;
> 	     return 200 "site A\n";
> 	   }


i didn't think of a regex-based server name.  that works perfectly.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20130303/c24d97ba/attachment.html>


More information about the nginx mailing list