forbid alias inside location given by regular expression
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 2334f6d..d769478 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -2674,6 +2674,18 @@
         return NGX_CONF_ERROR;
     }
 
+#if (NGX_PCRE)
+
+    if (lcf->regex && alias) {
+        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+                           "the \"alias\" directive may not be used "
+                           "inside location given by regular expression");
+
+        return NGX_CONF_ERROR;
+    }
+
+#endif
+
     value = cf->args->elts;
 
     if (ngx_strstr(value[1].data, "$document_root")