我在 上有一个正在运行的 Web 应用程序http://example.com/
,并且想在http://example.com/en
. 上游服务器proxy_pass
似乎可以工作,但有一个问题:
upstream luscious {
server lixxxx.members.linode.com:9001;
}
server {
root /var/www/example.com/current/public/;
server_name example.com;
location /en {
proxy_pass http://luscious;
}
}
Run Code Online (Sandbox Code Playgroud)
打开时example.com/en
,我的上游应用程序返回404 not found /en
。这是有道理的,因为上游没有 path /en
。
是proxy_path
正确的解决方案吗?我应该重写“上游”以便它/en
作为根路径监听吗?或者是否有指令允许我重写传递给上游的路径?
我试图让 nginx 忽略index.html
文件并始终显示模块中的目录列表autoindex
。
如果我删除我的index
行,nginx 仍然默认提供index.html
文件,所以这不是一个解决方案。
Stack Overflow 上也提出了类似的问题,但我正在寻找一种不涉及发明虚假文件名的解决方案,如果存在这样的解决方案(更不用说该线程在那里偏离主题)。
如何更改index
指令以告诉 nginx 从不显示索引文件?