February 2018
Beginner to intermediate
348 pages
9h 40m
English
Context: server
Assigns one or more hostnames to the server block. When Nginx receives an HTTP request, it matches the Host header of the request against all of the server blocks. The first server block to match this hostname is selected.
If no server block matches the desired host, Nginx selects the first server block that matches the parameters of the listen directive (for example, listen *:80 would be a catch-all for all requests received on port 80), giving priority to the first block that has the default_server option enabled on the listen directive.
Syntax: server_name hostname1 [hostname2...];