nginx从位置提供多索引文件
我想通过不同的uri来归档这个服务变量html文件,下面是我的配置nginx从位置提供多索引文件,nginx,Nginx,我想通过不同的uri来归档这个服务变量html文件,下面是我的配置 server { listen 8888; server_name localhost; location / { root html/test index foo.html } location /another { root html/test index bar.html } } 我想请求localhost:8888/另一个然后响应bar.html,它出现在我的
server {
listen 8888;
server_name localhost;
location / {
root html/test
index foo.html
}
location /another {
root html/test
index bar.html
}
}
我想请求localhost:8888/另一个
然后响应bar.html
,它出现在我的测试目录中,但我失败了:(
感谢您的时间,我如何修复上述配置。文件名是根据
根指令的值和URI构建的。因此,在本例中:
location /another {
root html/test;
index bar.html;
}
URI/other/bar.html
将位于html/test/other/bar.html
如果要首先从URI中删除位置
指令的值,请使用别名
指令
location /another {
alias html/test;
index bar.html;
}
URI/other/bar.html
将位于html/test/bar.html
有关详细信息,请参阅