Mercurial > hg > nginx-site
changeset 70:272d99af0c15
The "server_name" directive:
- has changed the default value from hostname to "",
- accepts the special argument "$hostname".
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Sun, 09 Oct 2011 21:19:52 +0000 |
parents | 935beaa561b3 |
children | c007b57d617c |
files | xml/en/docs/http/ngx_http_core_module.xml |
diffstat | 1 files changed, 14 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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</link> docume <directive name="server_name"> <syntax>server_name <argument>name</argument> ...</syntax> -<default>server_name hostname</default> +<default>server_name ""</default> <context>server</context> <para> @@ -1656,8 +1656,7 @@ server { </para> <para> -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 (<dq><code>*</code></dq>) to replace the first or last part of a name: <example> @@ -1677,6 +1676,11 @@ server { </para> <para> +If the argument equals “<var>$hostname</var>” (0.9.4), the +machine's hostname is substituted. +</para> + +<para> It is also possible to use regular expressions in server names, prepending the name with a tilde (<dq><code>~</code></dq>): <example> @@ -1709,8 +1713,8 @@ server { </para> <para> -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: <example> server { server_name ~^(www\.)?(?<domain>.+)$; @@ -1731,7 +1735,7 @@ server { </para> <para> -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): <example> server { server_name www.example.com ""; @@ -1739,6 +1743,10 @@ server { </example> It allows this server to process requests without the <header>Host</header> header, instead of the default server for the given address:port pair. +This is the default setting. +<note> +Before 0.8.48, the machine's hostname was used by default. +</note> </para> <para>