changeset 3855:6c5f2ba0397d

server_name $hostname
author Igor Sysoev <igor@sysoev.ru>
date Thu, 20 Jan 2011 15:31:24 +0000
parents 80cc7c8bb845
children fe671505a8ea
files src/http/ngx_http_core_module.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -3682,7 +3682,13 @@ ngx_http_core_server_name(ngx_conf_t *cf
         sn->regex = NULL;
 #endif
         sn->server = cscf;
-        sn->name = value[i];
+
+        if (ngx_strcasecmp(value[i].data, (u_char *) "$hostname") == 0) {
+            sn->name = cf->cycle->hostname;
+
+        } else {
+            sn->name = value[i];
+        }
 
         if (value[i].data[0] != '~') {
             ngx_strlow(sn->name.data, sn->name.data, sn->name.len);