NGINX 默认不支持 PATH_INFO 模式,需要修改NGINX配置 让NGINX 来解析 index.php/controller/f 这种模式
如果是通过设置虚拟域名来访问项目的话,应在虚拟域名配置文件里设置以下配置
具体配置:
#CI
server {
listen 80;
server_name www.ci.com;
index index.php index.html index.htm;
root "/servers/apps/CI";
location ~ \.php{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
##########################################pathinfo 模式
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$"){
set $real_script_name $1;
set $path_info $2;
}
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
##########################################nginx支持pathinfo 模式的重点
}
}