此教程適用於集成安裝包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