0

How does nginx determine the server to use when there is no default_server defined and it doesn't match server_name?

It was magically matching a server_name of localhost in the default sites-enabled file.

1 Answer 1

1

http://nginx.org/en/docs/http/request_processing.html

In this configuration nginx tests only the request’s header field “Host” to determine which server the request should be routed to. If its value does not match any server name, or the request does not contain this header field at all, then nginx will route the request to the default server for this port. In the configuration above, the default server is the first one — which is nginx’s standard default behaviour.

1
  • Is the first once alphabetical? If I have a,b,c,d should it use a? Commented Sep 27, 2012 at 18:16

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.