]> git.kaiwu.me - nginx.git/commitdiff
disable $document_root variable in the "root/alias" directive
authorIgor Sysoev <igor@sysoev.ru>
Sun, 1 Apr 2007 09:03:14 +0000 (09:03 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Sun, 1 Apr 2007 09:03:14 +0000 (09:03 +0000)
src/http/ngx_http_core_module.c

index 4a957d2234e6a3fbd89d122d1cb52980fde2e96d..5683c24053f6877a9fd2511fd6f949591a98d682 100644 (file)
@@ -2659,6 +2659,17 @@ ngx_http_core_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
 
     value = cf->args->elts;
 
+    if (ngx_strstr(value[1].data, "$document_root") != 0
+        || ngx_strstr(value[1].data, "${document_root}") != 0)
+    {
+        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+                           "the $document_root variable may not be used "
+                           "in the \"%V\" directive",
+                           &cmd->name);
+
+        return NGX_CONF_ERROR;
+    }
+
     lcf->alias = alias;
     lcf->root = value[1];