thinkphp pathinfo nginx 沒法加載模塊:Index

thinkphp 報了php

沒法加載模塊:Index

錯誤位置

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

這個錯,剛開始覺得是路由錯了,還跟了一下代碼,始終沒有答案,弄了一上午,最後好好看了一下官方文檔,才知道是pathinfo弄的貨nginx

config.php中設置
/* URL配置 */
'URL_CASE_INSENSITIVE' => true, // 默認false 表示URL區分大小寫 true則表示不區分大小寫
'URL_MODEL' => 2, // URL模式

接下來就是nginx 設置了thinkphp

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;
    }
}

這樣問題,就解決了,瞬間世界又清靜了spa

相關文章
相關標籤/搜索