2

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.

1 Answer 1

3

When looking in the error.log, located in /var/log/nginx/, I found no "ssl_certificate" is defined in server listening on SSL port while SSL handshaking

So adding a new block:

server
{
  listen 443 default_server;
  include includes/http/server/ssl.conf;
  return 444;
}

...while removing the listen 443 default_server from the former block, did the trick...


includes/http/server/ssl.conf

ssl_certificate     /etc/ssl/certs/crt.crt;
ssl_certificate_key /etc/ssl/private/key.key;
2
  • @Drifter104 why don't you just edit it, or simply add a comment suggestion improvements? The answer is correct! Now it's more complete....
    – superhero
    Jul 14, 2016 at 13:29
  • The overall parts were there but not in a way that someone looking for a solution to a similar problem could of found all that easy to put together. Now however it is a complete answer and I have reversed the downvote accordingly.
    – Drifter104
    Jul 14, 2016 at 13:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .