nginx位置指令卡滞

nginx位置指令卡滞,nginx,webserver,httpserver,winginx,Nginx,Webserver,Httpserver,Winginx,我正在windows上使用Winginx,修改conf文件夹下的nginx.conf文件。我已将侦听端口的服务器块更改为: server{ listen 127.0.0.1:80; log_not_found off; charset utf-8; access_log logs/access.log main; location /images/ { root home/localhost/public_html; index index.php index.html;

我正在windows上使用Winginx,修改conf文件夹下的nginx.conf文件。我已将侦听端口的服务器块更改为:

server{
 listen 127.0.0.1:80;
 log_not_found off;
 charset utf-8;

 access_log logs/access.log main;

 location /images/ {
  root home/localhost/public_html;
  index index.php index.html;
 }
}
images文件夹位于winginx的主文件夹下,并通过hostseditor作为域添加。但是,当我使用URL
http://images
,我得到404错误

如果位置指令更改为:

location / {
}

那么一切都好了。任何正则表达式都不能工作,除非我匹配“/”。我已经阅读了位置指示,但找不到任何相关原因。如果有人能指出错误,那就太有帮助了。谢谢。

原因是
location
指令匹配URI(更准确地说是请求URI的绝对路径),而不是主机

当您使用
http://images
,您的浏览器发送如下请求:

GET / HTTP/1.1
Host: images
请注意,请求URI是
/