美文网首页
thinkphp pathinfo nginx 无法加载模块:I

thinkphp pathinfo nginx 无法加载模块:I

作者: 一位先生_ | 来源:发表于2019-12-11 10:17 被阅读0次

    无法加载模块:Index.php
    错误位置
    FILE: /var/multrix/wxactivity_archive/ThinkPHP/Library/Think/Dispatcher.class.php  LINE: 177

    其实就是域名后跟index.php/admin/index/index (去掉index.php是可以访问的,存在就不行)
    最后经过几番折腾,才知道是pathinfo的原因

    1. 框架配置文件作出修改
      config.php中设置
    /* URL配置 */
    'URL_CASE_INSENSITIVE' => true, // 默认false 表示URL区分大小写 true则表示不区分大小写
    'URL_MODEL' => 2, // URL模式
    

    nginx.conf 设置

    server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;
    
        root 项目目录;
        index index.html index.htm index.php;
    
        # Make site accessible from http://localhost/
        server_name 域名或ip地址;
       
    
    
        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 127.0.0.1:9000;
            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;
        }
    }
    

    就这些改动 亲测可用 希望能帮到你们!

    相关文章

      网友评论

          本文标题:thinkphp pathinfo nginx 无法加载模块:I

          本文链接:https://www.haomeiwen.com/subject/hgqogctx.html