Nginx PATH_INFO配置
程序员文章站
2024-01-02 19:52:46
...
我的配置现在是这样的
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
怎么配置出$_SERVER['PATH_INFO']出来??
回复内容:
我的配置现在是这样的
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
怎么配置出$_SERVER['PATH_INFO']出来??
location ~ \.php$ {
fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME /path/to/php$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
}
location / {
if (!-e $request_filename)
{
rewrite ^/xxxx/(.*)$ /xxx/index.php/$1 last;
}
}
看看这个把。
Nginx配置PATHINFO
推荐阅读
-
struts2+Spring3+hibernate3零配置并且正式环境和开发环境不需要多大改动 Struts
-
配置MySQL服务的自启动
-
nginx 反向代理及动静分离
-
如何使用nginx或php将请求转发到另一个地址
-
linux下配置lamp时候出现The requested URL /info.php was not found on this server问题
-
MySQL修改配置 区分大小写
-
联想y720笔记本配置(详解联想拯救者r720详细参数)
-
创建Oracle 11g数据库后脚本文件执行及相关配置
-
一、记一次失败的 CAS 搭建 之 环境配置_PHP教程
-
nginx + php 执行过程中出现404该怎么解决