我通过nginx提供静态网站,我的目标是替换看起来像这样的网址:
同
关键是没有尾随斜线.我目前正在使用位置别名做类似的事情,但这很繁琐,因为它需要每个文件的位置块,并且它还附加一个尾部斜杠,因为nginx将别名看作目录:
location / {
root /srv/www/foo/public_html;
index index.html;
}
location /bar1 {
alias /srv/www/foo/public_html/;
index bar1.html;
}
location /bar2 {
alias /srv/www/foo/public_html/;
index bar2.html;
}
等等.我已经阅读了有关重写的文档,而我似乎无法综合我所需要做的事情.我不是从Apache背景进来的; nginx是我第一次涉足网络服务器,所以我确定我错过了一些明显的东西,因为我的HTTP背景很弱.提前感谢您提供的任何帮助.