Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
Is the first once alphabetical? If I have a,b,c,d should it use a? –  Chris Muench Sep 27 '12 at 18:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.