让nginx支持PATH_INFO
摆弄了半天终于弄好了...虽然不是原创也发个帖点下注意的地方server {listen 80;
server_namelocalhost;
index index.html index.htm index.php;
root /xampp/htdocs;
autoindex on;
location ~ .*\.php {//这里注意php 末尾不要加$ 要不就隔断不能匹配
fastcgi_pass 127.0.0.1:9000;
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {//这里拆分下
#set $real_script_name $1;
set $path_info $2;//CI里面我设置的是AUTO用的PATH_INFO就行
}
fastcgi_param PATH_INFO $path_info;
include /APMServ5.2.6/nginx/conf/fastcgi_params;
}
log_formataccess'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log/APMServ5.2.6/nginx/logs/access.logaccess;
}
} 虽然不用nginx,还是顶楼主 楼主这贴真救了我的命了,NGINX试了REQUEST_URI和QUERY_STRING都不行,自己还改了PHP.INI里的CGI.FIX PATH_INFO都不行,最后终于按照楼主所说的搞定了,感激 好东西。 我用你的方法,没有成功!:'(
server {
listen 80;
server_name www.damuqiao.com damuqiao.com;
index index.html index.htm index.php;
root /data0/htdocs/damuqiao/yiyao/web;
autoindex on;
location ~ .*.php {
fastcgi_pass 127.0.0.1:9000;
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?.php)(/.+)$") {
#set $real_script_name $1;
set $path_info $2;
}
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME /data0/htdocs/damuqiao/yiyao/web/$fastcgi_script_name;
include /usr/local/nginx/conf/fastcgi_params;
}
log_formatdamuqiao'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log/data1/logs/damuqiao.logdamuqiao;
}
楼主这办法虽然可行,但并不好,而且 SCRIPT_NAME 也不标准,看我的例子,简单明了并且纠正了 SCRIPT_NAME 的错误
location ~ \.php($|/) {
root E:/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAMEE:/www$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
还是楼主的好,我成功了,感谢楼主 好像还是不行。哎 哈, 我们服务器也用的这个. 我不会搞, 有老大在上面顶着, 哈哈. 好东西啊,牛白
页:
[1]
2