我粘贴了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 /test
与http://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;
}
}
}