NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
silenceeeee
V2EX  ›  NGINX

请求一个 nginx 配置问题

  •  
  •   silenceeeee · Oct 10, 2016 · 2584 views
    This topic created in 3531 days ago, the information mentioned may be changed or developed.
    location ~ ^/admin{
    rewrite ...;
    }
    这样用 nginx -t 检测的时候不会报错.

    location ~ \.php${
    ...
    }
    这样会报错: nginx: [emerg] directive "location" has no opening "{"

    1. 两个"{"之前都没有加空格 .为什么一个报错.一个不报错呢
    2. "{"前面到底要不要加空格?
    2 replies    2016-10-10 13:25:51 +08:00
    rrfeng
        1
    rrfeng  
       Oct 10, 2016
    1. $ 是变量标识,比如 $http_host 这样,所以连在一起的时候就解析错误了(被认为是 `${` 变量)。
    2. 当然加空格
    silenceeeee
        2
    silenceeeee  
    OP
       Oct 10, 2016
    @rrfeng 谢谢 明白了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4028 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 05:07 · PVG 13:07 · LAX 22:07 · JFK 01:07
    ♥ Do have faith in what you're doing.