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;
}
#主要是 include 下面的幾行哦 .
天蓬老师2017-05-16 17:21:19
Nginx 本身沒有自動產生 PATH_INFO 的功能,這就讓一些透過 $_SERVER['PATH_INFO'] 來進行調度的框架不能正常進行路由調度。而 include 之下的這段程式碼,就是進行 PATH_INFO 的偵測,並寫入到 Server 參數中傳給 PHP。