Why won't my configuration route to the specific server_name
when it's specified?
Part of my config:
server
{
listen 443 ssl;
server_name foo-bar.example.com;
include includes/http/server/ssl.conf;
location /
{
#...
}
}
server
{
listen 80 default_server;
listen 162 default_server;
listen 443 default_server;
listen 465 default_server;
listen 3306 default_server;
listen 9200 default_server;
return 444;
}
However, going to the domain foo-bar.example.com
returns the 444
status. When I remove the last block, it works as expected.
I tried adding:
server_name ""
server_name _
...in the last block without success.
The priorities defined on this page: http://nginx.org/en/docs/http/server_names.html
- exact name
- longest wildcard name starting with an asterisk, e.g. “*.example.org”
- longest wildcard name ending with an asterisk, e.g. “mail.*”
- first matching regular expression (in order of appearance in a configuration file)
...tells me that what I do should work, imo.