ThinkPHP3.2.3項目放到lnmp環境之后只能打開首頁,或者通過傳參方式打開控制器,否則就一直顯示404頁面。搞了一上午,終於解決了
step1:
修改php.ini
cgi.fix_pathinfo=1
step2:
修改nginx.conf或者vhost/*.conf
注釋掉include enable-php.conf
添加include enable-php-pathinfo.conf
step3:
加入重寫規則
location / {
if (!-e $request_filename) {
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
index index.html index.htm index.php l.php;
autoindex off;
}
step4:
重啟lnmp:
lnmp restart