location ~ \.php {
# try_files $uri =404;
fastcgi_index /index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
Mainly include the following lines.
天蓬老师2017-05-16 17:21:19
Nginx itself does not have the function of automatically generating PATH_INFO, which means that some frameworks that use $_SERVER['PATH_INFO'] for scheduling cannot perform route scheduling normally. The code under include detects PATH_INFO and writes it into the Server parameter and passes it to PHP.