此教程适用于內建安裝包lnmp,官網是https://lnmp.org/
一、 開啟pathinfo
#注釋 下面這一行
#include enable-php.conf
#載入新的配置檔案
include enable-php-pathinfo.conf
二、 開啟rewrite
在server最後添加如些的配置
#添加如下
location / {
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~ /index.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
include fastcgi_params;
fastcgi_param APPLICATION_ENV dev;
}
三、 重新開機服務
service nginx restart