天天看點

nginx php站點配置檔案,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;

}

}

内容來源于網絡如有侵權請私信删除