Setting up an nginx configuration to have all domains go to one server block, except one
What would need to be done to achieve the following server configuration?
abc.com, def.com, ghi.com, and all 开发者_StackOverflow社区others pointed to this IP -> server block A.
specialdomain.com only -> server block B.
I've tried creating two server blocks, one with server_name localhost with listen 8080 default, another with server_name specialdomain.com with listen 8080, but it's piping all of the requests to the first server block.
The solution is to set up one specific nginx conf block for specialdomain.com
, then have a general catch-all nginx config block for the rest.
One block should have the server_name
set to www.specialdomain.com specialdomain.com
, and the other block should have it set to localhost
.
精彩评论