My code in the WNMP environment is running normally, but in the LNMP environment found that ThinkPHP5 pathinfo failure, resulting in route:rule also can not use. Even according to the official website to add some code is only useful home page, click on other pages may still cause 404 or 500 errors. The following solutions were finally found. Finally, I'll post my configuration 1. Modify the/usr/local/php/etc/php.ini file
Search cgi.fix_pathinfo=0, change its value to 1
2. Modify/usr/local/nginx/conf/nginx.conf (or vhost) files
Add to
include/usr/local/nginx/conf/enable-php-pathinfo.conf;
Location/{
index index.html index.htm index.php l.php;
AutoIndex off ;
if (!-e $request _filename) {
rewrite ^ (. *) $ /index.php?s=/$1 last ;
}
}
3. Nginx Reload configuration file
Nginx-s relaod
Here's my profile.
server {Listen 80;
server_name Www.vm2phplive.io;
Root "/home/wwwroot/phplive/public";
include/usr/local/nginx/conf/enable-php-pathinfo.conf;
Location/{index index.html index.htm index.php l.php;
AutoIndex off;
if (!-e $request _filename) {rewrite ^ (. *) $/index.php?s=/$1 last; } # REDIRECT Server error pages to the static page/50x.html # Error_page 500 502 50
3 504/50x.html;
Location =/50x.html {root html; }
}