How to exclude Nginx adding /index.html after my url?

问题描述 投票:0回答:1

我有一个 ads.txt 的别名,但是当我访问 /ads.txt 并查看 error.log 时,会出现此错误:

[error] 20051#20051: *457 "/root/public/front/public/ads.txt/index.html" is not found (20: Not a directory), client: 172.70.55.104, server: server.com, request: "GET /ads.txt/ HTTP/2.0", host: "server.com" 
obs:我为这个问题更改了 server.com 的 URL。

这是我的别名代码:

 location /ads.txt { alias /root/public/front/public/ads.txt; }

我曾尝试更改权限,因为在发生该错误之前我遇到了问题。

nginx nginx-config
1个回答
0
投票

尝试:

location /ads.txt {
   root /root/public/front/public/;
}
© www.soinside.com 2019 - 2024. All rights reserved.