[英]How to redirect in nginx to index file
我有一個簡單的例子:
location / {
rewrite ^/$ /index.html last;
root /test/;
fastcgi_pass 127.0.0.1:7777;
include fastcgi_params;
}
ti如何將“ /”重定向到/index.html?
在配置中添加以下指令(並刪除重寫)
index index.html;
會告訴nginx將index.html用於任何目錄,有關詳細信息,請參見http://nginx.org/en/docs/http/ngx_http_index_module.html#index
雖然給定fastcgi位,您可能想要index.php代替?
通常,您還希望將根目錄移到服務器塊,而不是位置塊(以免在每個位置塊重復自己)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.