thinkphp pathinfo nginx 无法加载模块:Index

时间:2023-03-08 17:00:13

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' => , // URL模式

接下来就是nginx 设置了

server {
listen default_server;
listen [::]: 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/$ last;
break;
}
} location ~ .+\.php($|/) {
set $script $uri;
set $path_info "/";
if ($uri ~ "^(.+\.php)(/.+)") {
set $script $;
set $path_info $;
} fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php?IF_REWRITE=;
include fastcgi_params;
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root/$script;
fastcgi_param SCRIPT_NAME $script;
}
}

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