nginx conf文件中'location /'和'location = /'之间的区别是什么

时间:2012-05-19 08:24:06

标签: nginx

我粘贴了ngx_http_core_module网站上的说明:

location  = / {
  # matches the query / only.
  [ configuration A ] 
}
location  / {
  # matches any query, since all queries begin with /, but regular
  # expressions and any longer conventional blocks will be
  # matched first.
  [ configuration B ] 

但在我的默认配置文件设置中,location //test/不匹配,但它表示它应该匹配任何查询,location = /与任何内容都不匹配。最后,location /testhttp://example.com/test不匹配。

我的nginx.conf文件:

worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include mime.types;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;
    server {
        listen 80;
        server_name 122.97.248.252;
        location /test {
            root /home/yozloy/html/;
            autoindex on;
        }
        error_page 500 502 503 504  /50x.html;
        location = /50x.html {
            root html;
        }
    }
}

0 个答案:

没有答案