![](/img/trans.png)
[英]How do I config nginx to serve any path to a single specific html file?
[英]nginx - Serve Single URL with Absolute FIle Path
我有一個網站,訪問單個網址的流量很多。
https://www.awebsite.com/some/really/long/search-friendly/url/my-url.html
我想提供此服務,並且僅使用nginx靜態地提供此網址。 靜態html文件位於/my/html-files/myfile.html中,具有正確的權限。
我不希望此網址受到影響:
https://www.awebsite.com/some/really/long/search-friendly/url/some-other-url.html
我試過了...
location = /some/really/long/search-friendly/url/myfile.html {
alias /my/html-files/myfile.html;
}
和...
location = /some/really/long/search-friendly/url/myfile.html {
root /my/html-files/myfile.html;
}
和...
location = /some/really/long/search-friendly/url/myfile.html {
root /my/html-files/;
}
我什么都不能工作。 請幫忙! 謝謝。
更新:
原來,這在Chrome和Opera中都可以使用。
location = /some/really/long/search-friendly/url/myfile.html {
alias /my/html-files/myfile.html;
}
無論出於何種原因,在Firefox中,我都會不斷重定向到https://www.awebsite.com/some/really/long/search-friendly/url/my-url.html/ 。 對於為什么僅在FF中發生這種情況感到很困惑,但是,我現在就來看它。
原來,這在Chrome和Opera中都可以使用。
location = /some/really/long/search-friendly/url/myfile.html {
alias /my/html-files/myfile.html;
}
如果不是,請參閱評論; 這可能是瀏覽器緩存問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.