How to exclude specific subdomains server_name in nginx configuration -
i'm using wildcard in server_name
. want redirect subdomains of example.com
(configured *.example.com) foo.com
except xyz.example.com
i have configuration follows
server { listen 80; server_name *.example.com; location / { proxy_pass http://$1.foo.com; } }
i don't want change request coming xyz.example.com
you need @ least 2 server blocks, , nginx
select more specific server block handle request. see this document details.
you need server block xyz.example.com
such as:
server { listen 80; server_name xyz.example.com; location / { proxy_pass http://$1.foo.com; } }
then either default_server
or wild card server, such as:
server { listen 80; server_name *.example.com; return http://foo.com/; }
or:
server { listen 80 default_server; return http://foo.com/; }
Comments
Post a Comment