2012-10-22 27 views
0

我有簡單的例子:如何nginx的重定向到索引文件

location/{ 
     rewrite ^/$ /index.html last; 
     root /test/; 
     fastcgi_pass 127.0.0.1:7777; 
     include fastcgi_params; 
    } 

TI如何重定向 「/」 到/index.html?

回答

0

加入下面的指令到您的配置(並刪除重寫)

index index.html; 

會告訴nginx的使用index.html的任何目錄, 見http://nginx.org/en/docs/http/ngx_http_index_module.html#index的細節

雖然給出的FastCGI的位你可能想要index.php呢?

通常你也想把根移到你的服務器塊而不是在位置塊(這樣就不必在每個位置塊重複你自己)