nginx :nginx/1.14.1
问题描述:
在 location 中写了一个正则表达式,
server {
listen 80;
server\_name mytest;
location / {
alias /e:/mytest/;
}
location ~^/(.+)$ { # 正则表达式 修改为 ~ /(.+) 效果一样
alias e:/mytest/$1/home/;
}
}
这时如果通过浏览器通过 http://mytest/mod\_name
访问,却会提示我 404,然后查看 ngx 的日志提示:
2020/03/11 15:38:35 [error] 18744#10804: *1 CreateFile() "e:/mytest/mod_name/index.html/home/" failed (3: The system cannot find the path specified), client: 127.0.0.1, server: mytest, request: "GET /mod_name/ HTTP/1.1", host: "mytest"
也就是说,在我请求的 mod_name 后面自动拼接了一个 index.html 上去,不知道这个是怎么回事。
查阅了 ngx 的文档后,似乎也没有太多关于这方面说明的。
网上也没有找到这样的问题。不知道这是什么原因造成的?