]> git.kaiwu.me - nginx.git/commitdiff
server_name $hostname
authorIgor Sysoev <igor@sysoev.ru>
Thu, 20 Jan 2011 15:31:24 +0000 (15:31 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Thu, 20 Jan 2011 15:31:24 +0000 (15:31 +0000)
src/http/ngx_http_core_module.c

index 5e682f2b9cb21a70dab0578e07fa52c021478841..693a3cb32f57494bff655cc97257a168a2f6a70b 100644 (file)
@@ -3682,7 +3682,13 @@ ngx_http_core_server_name(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
         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);