如何排除Nginx在我的URL后添加/index. html?

6fe3ivhb  于 2023-03-29  发布在  Nginx
关注(0)|答案(1)|浏览(220)

我有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"

(我已经将此问题的URL更改为server.com
这是我的别名代码

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

我已经尝试更改权限,因为在出现该错误之前,我遇到了问题。

kb5ga3dv

kb5ga3dv1#

试试看:

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

相关问题