Chapter 2
[ 33 ]
This logic is expressed in the following flowchart:
Host header matches
server_name with a
wildcard at the front?
Is there a
default_server?
Find sever context
with listen/port match
Does the Host header
match the server_name
as a string?
Host header matches
server_name with a
wildcard at the end?
Host header matches
server_name with a
regular expression?
Does the IP/port
match the listen?
Request from client
Find server context
with listen/port match
Find server context
with listen/port match
Direct to
default_server
Continue with request
processing.
Ye s
Ye s
Ye s
Ye s
Ye s
Ye s
Ye s
No
No
No
No
No
No
No
default_server can be used to handle requests that would otherwise go unhandled.
It is therefore recommended to always set default_server explicitly, so that these
unhandled requests will be handled in a defined manner.