# HG changeset patch # User Ruslan Ermilov # Date 1318195192 0 # Node ID 272d99af0c159d89349bf6a1c4a00c0e79064796 # Parent 935beaa561b3d50284891a4e9145087cdf10d23c The "server_name" directive: - has changed the default value from hostname to "", - accepts the special argument "$hostname". diff --git a/xml/en/docs/http/ngx_http_core_module.xml b/xml/en/docs/http/ngx_http_core_module.xml --- a/xml/en/docs/http/ngx_http_core_module.xml +++ b/xml/en/docs/http/ngx_http_core_module.xml @@ -1643,7 +1643,7 @@ Setting Up Virtual Servers docume server_name name ... -server_name hostname +server_name "" server @@ -1656,8 +1656,7 @@ server { -The first name becomes a primary server name. -By default, the machine's hostname is used. +The first name becomes the primary server name. Server names can include an asterisk (*) to replace the first or last part of a name: @@ -1677,6 +1676,11 @@ server { +If the argument equals “$hostname” (0.9.4), the +machine's hostname is substituted. + + + It is also possible to use regular expressions in server names, prepending the name with a tilde (~): @@ -1709,8 +1713,8 @@ server { -Starting from version 0.8.25, named captures in regular expressions create -variables that can later be used in other directives: +Named captures in regular expressions create variables (0.8.25) +that can later be used in other directives: server { server_name ~^(www\.)?(?<domain>.+)$; @@ -1731,7 +1735,7 @@ server { -Starting from version 0.7.11, it is possible to specify an empty name: +It is also possible to specify an empty server name (0.7.11): server { server_name www.example.com ""; @@ -1739,6 +1743,10 @@ server { It allows this server to process requests without the
Host
header, instead of the default server for the given address:port pair. +This is the default setting. + +Before 0.8.48, the machine's hostname was used by default. +