小编Max*_*ter的帖子

如何使用 nginx proxy_pass 删除路径

我在 上有一个正在运行的 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 path proxypass

128
推荐指数
4
解决办法
20万
查看次数

强制 nginx 始终自动索引并忽略 index.html 文件?

我试图让 nginx 忽略index.html文件并始终显示模块中的目录列表autoindex

如果我删除我的index行,nginx 仍然默认提供index.html文件,所以这不是一个解决方案。

Stack Overflow 上也提出了类似的问题,但我正在寻找一种不涉及发明虚假文件名的解决方案,如果存在这样的解决方案(更不用说该线程在那里偏离主题)。

如何更改index指令以告诉 nginx 从不显示索引文件?

configuration nginx directoryindex

4
推荐指数
1
解决办法
3933
查看次数

标签 统计

nginx ×2

configuration ×1

directoryindex ×1

path ×1

proxypass ×1