我正在使用 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 / {
}
那时一切正常。除非我匹配“/”,否则任何正则表达式都不起作用。我已阅读位置指令,但找不到任何相关原因。如果有人能指出错误,那将是很大的帮助。谢谢。