nginx使用代理传递重写所有尾部/to/index.html

nginx使用代理传递重写所有尾部/to/index.html,nginx,Nginx,使用nginx作为反向代理,我想用proxy\u pass模拟index指令。因此,我希望nginx查询/index.html而不是/,/sub/index.html而不是/sub/ 这样做的最佳方法是什么 不确定它是否相关,但代理服务器确实在/上回答HTTP 200,但我仍然希望将其重写为/index.html 由于/请求通过列出目录内容泄漏了一些信息,我还想确保没有人能够访问它(比如做/sub/.) 谢谢只需添加: rewrite (.*)/$ $1/index.html last; rew

使用nginx作为反向代理,我想用
proxy\u pass
模拟
index
指令。因此,我希望nginx查询
/index.html
而不是
/
/sub/index.html
而不是
/sub/

这样做的最佳方法是什么

不确定它是否相关,但代理服务器确实在
/
上回答
HTTP 200
,但我仍然希望将其重写为
/index.html

由于
/
请求通过列出目录内容泄漏了一些信息,我还想确保没有人能够访问它(比如做
/sub/.

谢谢

只需添加:

rewrite (.*)/$ $1/index.html last;
rewrite (.*)/..$ $1/../index.html last;
应该有效