让Nginx支持php的PHP_INFO
来源:互联网 发布:脚本编程课程 编辑:程序博客网 时间:2024/05/18 03:31
通常我们在配置nginx使其支持php时,都是进行类似如下配置:
location ~ .php$ {root /var/www/bbs.dingd.cn;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}
(反正我每次都偷懒,复制粘贴来就使用)
上述配置正常使用起来没什么问题,但是一旦遇到这样的url,就炸了:
/index.php/content/123.html
因为配置中是将以.php结尾的文件交给php-fpm处理,那么这样的url结尾就是.html所以肯定返回404啦。而且,php也是获取不到php_info这个值得。
so,经常半天的百度啊 百度,终于找到如下配置,可以正常使用(我稍微改动了一下)
location ~ (\.php)(.*)$ {root /var/www/bbs.dingd.cn;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_split_path_info ^(.+\.php)(.*)$;#PHP中要能读取到pathinfo这个变量#就要通过fastcgi_param指令将fastcgi_split_path_info指令匹配到的pathinfo部分赋值给PATH_INFO#这样PHP中$_SERVER['PATH_INFO']才会存在值fastcgi_param PATH_INFO $fastcgi_path_info;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params; }
阅读全文
0 0
- 让Nginx支持php的PHP_INFO
- 【linux】让服务器支持php 和java在nginx 服务器的共存
- 让nginx完美支持Thinkphp的配置
- 让 nginx 支持 pathinfo
- 让Nginx支持CGI
- 让nginx支持PATH_INFO
- 让Nginx支持Lua
- 让Nginx支持pathinfo
- 让nginx支持pathinfo
- 让Nginx支持pathinfo
- 让nginx 支持pathinfo
- Nginx下alias支持PHP的问题解决
- nginx + PHP 下 添加 https 的支持
- Nginx支持PHP的CI框架
- 让IIS支持PHP的配置方法
- 让busybox的http服务支持php
- 让PHP支持imagemagick的Windows安装
- [zz] 让ctags更好的支持php
- Go如何按行读取文件及bufio.Split()函数的使用
- The difference between BEB in MACA and in MACAW
- 1106. Lowest Price in Supply Chain (25)
- 5、单例模式(用枚举enum实现)
- svn: E020024: Error resolving case of
- 让Nginx支持php的PHP_INFO
- 1004. Counting Leaves (30)
- 字体图标的使用
- CentOS6.7源码安装vim-8.0
- (超级治愈!)关于创建String对象过程的内存分配
- PAT 甲级 1122. Hamiltonian Cycle (25)
- 杀死占用某端口的进程
- 哥德尔不完全性定理探索数学边界
- haxe 第二期 入门篇 (转载)