首頁  >  文章  >  後端開發  >  PHP 網站修改預設存取檔案的nginx配置

PHP 網站修改預設存取檔案的nginx配置

不言
不言原創
2018-06-02 14:07:271265瀏覽

這篇文章主要介紹了PHP 網站修改預設存取檔案的nginx配置,需要的朋友可以參考下

搭建好lnmp後,有時候並不需要直接存取index.php,配置其他的預設存取檔案例如index.html這時候需要設定nginx才能存取到你想要設定的檔案

直接上程式碼,如下是我的設定的一份簡單的nginx到php-fpm的站點,該網站預設存取目錄/ecmoban/www/index.html

server {
listen 80;
location / {
root /ecmoban/www;
index index.html index.php index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
root /ecmoban/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.html;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

#相關推薦:

##PHP網站如何應對大流量與高並發問題

PHP網站常見攻擊方式

以上是PHP 網站修改預設存取檔案的nginx配置的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn