2 回答

TA貢獻1993條經驗 獲得超6個贊
修改nginx的默認頁有很多方法,下面介紹兩種:
(1)在location中通過index指令設置:此時如果訪問127.0.0.1nginx會請求/home/wangwei/webroot/index.html文件并產生響應
1 2 3 4 5 6 7 | location ~ \.php$ { root /home/wangwei/webroot; index index.html; fastcgi_pass 127.0.0.1:9000; include fastcgi.conf; include fastcgi_params; } |
(2)通過rewrite指令重定向/請求
1 2 3 4 5 6 7 8 9 10 | location ~ \.php$ { root /home/wangwei/webroot; index index.html; fastcgi_pass 127.0.0.1:9000; include fastcgi.conf; include fastcgi_params;
#重定向首頁. rewrite "^/+$" /xxx.php break; } |
可以根據需要采用其中的任何一種。
- 2 回答
- 0 關注
- 4191 瀏覽
添加回答
舉報