• thinkphp pathinfo nginx 无法加载模块:Index


    thinkphp 报了

    无法加载模块:Index

    错误位置

    FILE: /var/multrix/wxactivity_archive/ThinkPHP/Library/Think/Dispatcher.class.php  LINE: 177

    这个错,刚开始以为是路由错了,还跟了一下代码,始终没有答案,弄了一上午,最后好好看了一下官方文档,才知道是pathinfo弄的货

    config.php中设置
    /* URL配置 */
    'URL_CASE_INSENSITIVE' => true, // 默认false 表示URL区分大小写 true则表示不区分大小写
    'URL_MODEL' => 2, // URL模式

    接下来就是nginx 设置了

    server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;
    
        root /var/multrix/new_server_archive;
        index index.html index.htm index.php;
    
        # Make site accessible from http://localhost/
        server_name 192.168.99.100;
        #server_name 10.0.2.15;
    
    
        location / {
            index  index.php;
            if (!-e $request_filename) { 
                rewrite  ^/(.*)$  /index.php/$1  last;
                break;
            }
        }
    
        location ~ .+.php($|/) {
            set $script    $uri;
            set $path_info  "/";
            if ($uri ~ "^(.+.php)(/.+)") {
                set $script     $1;
                set $path_info  $2;
             }
                 
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index  index.php?IF_REWRITE=1;
            include fastcgi_params;
            fastcgi_param PATH_INFO $path_info;
            fastcgi_param SCRIPT_FILENAME  $document_root/$script;
            fastcgi_param SCRIPT_NAME $script;
        }
    }

    这样问题,就解决了,瞬间世界又清静了

  • 相关阅读:
    聊天工具分享bug
    Git命令查看代码提交次数
    短链接生成实例
    .Net MVC用户注册验证码
    js写验证码
    笔记
    jq获取数组中的某个字段拆分成字符串。
    IIS部署后中文Cookie乱码
    C#反射(Reflection)与特性(Attribute)实例
    jmm
  • 原文地址:https://www.cnblogs.com/jackluo/p/5685037.html
Copyright © 2020-2023  润新知