Default host is being ignored?

I created a default conf file:

server {
listen 80 default;
listen 443 default;
server_name “”;
return 444;

and linked it in sites-enabled.

The other server is declared with:

server {
listen 80;
listen 443 ssl;


Accessing the https://xx.xx.xx.xx (the IP address) uses the
host instead of using the default, which should reject the request. The
browser is sending the host as “xx.xx.xx.xx”. This should not match the file. So why is it it not using the right server?

I’ve also tried leaving server name blank and adding “ssl” after 443 in
listen directive, but it still ignores the default server and uses the one instead.

Posted at Nginx Forum:

1°) Ensure the config files are all included (starting with main
files, then following all ‘include’ logic). The ‘sites-available’ logic
due to some distributions packaging and is not there in the official
Usually this is OK, but checking cannot hurt. :o)

2°) Ensure your configuration is loaded, ie the syntax is correct and
nginx is actually applying it.

  • use nginx -t to check the available config does not contain errors
  • send SIGHUP to nginx master to reload the configuration (and check
    for messages regarding it)
    … or use the probably available ‘reload’ command from your system
    management script which does both steps, knowing what you are doing

3°) Ensure the reply you see in your client is the one sent by the
(ie take care about any intermediate cache).
One way of effectively doing that is monitoring the access.log file
exists in the default nginx configuration, though
Another (complementary) way of doing the same is using cURL on the
command-line, querying your server on the right interface

If you are still experiencing difficulties, please provide details about
your problem and your attempts (and their result aswell) to solve it.

B. R.