原理:
    任意创建一个 in.php 文件:
            <?php
                      echo '<pre>';
                      var_dump($_SERVER);
               ?>
     localhost/in.php/a/b/c    apache 用此 url 访问,会打印 pathinfo 模式信息。而 nginx 默认访问是没有的。所以 tp 框架在 nginx 上运行时,不开启 pathinfo 模式会报错。
 
配置方式:
      location ~ \.php${                     #配置前
               root html;
               fastphp_pass 127.0.0.1:9000;
               fastcgi_index index.php;
               fastcgi_param SCRIPT_FILENAME $DOCUMENT_ROOT$fastcgi_script_name;

               include fastcgi_params;

       }

      location ~ \.php(.*)${               #修改后,支持 pathinfo

                root html;

                fastcgi_pass 127.0.0.1:9000;

                fastcgi_index index.php;

                fastcgi_param SCRIPT_FILENAME $DOCUMENT_ROOT$fastcgi_script_name;

                fastcgi_param PATH_INFO $1;

                include fastcgi_params;

       }

            这样 nginx 就支持 pathinfo 模式了。nginx 访问 in.php 打印的 server 也会有 pathinfo 参数。


使得nginx支持pathinfo访问模式的更多相关文章

  1. 使nginx支持pathinfo模式

    在将fastadmin部署到虚拟机中时,遇到如下问题:当访问登录页面时,页面进行不断的循环跳转重定向.解决方法是将nginx配置为支持pathinfo的模式 以下是nginx中的配置内容: locat ...

  2. nginx支持pathinfo模式

    很久不使用apache了,渐渐对apache感到陌生,因为朋友有个ZendFramework框架从apache移到nginx下,需要pathinfo模式支持.网上海搜于是开始搜索nginx+pathi ...

  3. 配置Nginx支持pathinfo模式

    Nginx服务器默认不支持pathinfo, 在需要pathinfo支持的程序中(如thinkphp),则无法支持”/index.php/Home/Index/index”这种网址.网上流传的解决办法 ...

  4. nginx支持pathinfo并且隐藏index.php

    How To Set Nginx Support PATHINFO URL Model And Hide The /index.php/ 就像这样 The URL before setting lik ...

  5. centOS7.4 thinkPHP nginx 支持pathinfo和rewrite

    server { listen 80; server_name www.demo.com mayifanx.com; root /data/www/demo; index index.php inde ...

  6. 让Nginx支持pathinfo

    # 典型配置 location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_ ...

  7. nginx 支持https访问

    1,先确认nginx安装时已编译http_ssl模块. 就是执行nginx -V命令查看是否存在--with-http_ssl_module.如果没有,则需要重新编译nginx将该模块加入.yum安装 ...

  8. nginx 支持pathinfo的配置文件

    location ~ \.php { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; set ...

  9. nginx 支持pathinfo

      location ~ \.php { #去掉$ root H:/PHPServer/WWW; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.ph ...

随机推荐

  1. pip更新问题

    pip更新及Requirement already up-to-date解决方法 pip更新 更新命令 将pip更新版本 1 python -m pip install --upgrade pip R ...

  2. Uncaught TypeError: undefined is not a function

    index.html <script src="resources/sap-ui-core.js" id="sap-ui-bootstrap" data- ...

  3. php 添加redis扩展

    我主要是按照http://blog.163.com/fan_xy_qingyuan/blog/static/1889877482014111111283265/ 这篇博客来的,但是这篇博客里只有php ...

  4. 使用rman恢复数据小结

    恢复前提有数据备份 以 alter database open resetlogs 开机以后多要做一次全备(以前的备份失效了) 恢复参数文件: restore spfile from '/home/o ...

  5. RocketMQ学习笔记(1)----RocketMQ的简介

    1. 什么是RocketMQ? 是一个队列模型的消息中间件,具有高性能.高可靠.高实时.分布式特点. Producer.Consumer.队列都可以分布式.  Producer 吐一些队列轮流収送消息 ...

  6. NOIp模拟赛三十四(yxq供题)

    毒瘤yxq! 毒瘤yxq! 毒瘤yxq! 据yxq自己说,林导让他出题的时候要求是“代码量少”,“思维难度高”,“不涉及太复杂的算法”,而且“最好要让myh有一题做不出来”(狙击myh).于是今天的题 ...

  7. PHP SOAP模块的使用方法:NON-WSDL模式

    PHP SOAP扩展可以帮助我们很轻松的实现web service服务,在PHP的SOAP扩展中主要有两种操作模式:WSDL模式和NON-WSDL模式,前者通过使用WSDL文件名作为参数,并从 WSD ...

  8. crontab执行脚本和手动执行脚本输出结果不一致的问题处理

    背景:huskiesir最近用公司给分配的账户写了脚本去检测某应用状态并发送到企业邮箱,写完脚本之后去执行了一下,发现效果还不错,在邮箱显示效果如下: 10.11.116.6  检查结果OK,检查时间 ...

  9. Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

    解决方法: 1.进入启动文件目录 2.将用户加入到docker 组 sudo gpasswd -a ${USER}  docker 3.使用root用户 sudo su 4. 切换当前用户 su ${ ...

  10. collections模块-namedtuple

    namedtuple -> 命名元组 这里的命名指的是对元组中元素的命名. 通过一个例子来看 import collections Person = collections.namedtuple ...