简单解决lnmp环境下不支持thinkphp路由(pathinfo模式)

来源:互联网 发布:流量精灵软件 编辑:程序博客网 时间:2024/06/07 04:57

think开发的项目放到lnmp环境路由不生效,需要配置一下nginx,
将原来location ~ .php屏蔽,重新配置如下

location ~ \.php {    fastcgi_pass 127.0.0.1:9000;    fastcgi_index index.php;    include fastcgi_params;    set $real_script_name $fastcgi_script_name;    if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {        set $real_script_name $1;        set $path_info $2;    }    fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;    fastcgi_param SCRIPT_NAME $real_script_name;    fastcgi_param PATH_INFO $path_info;}
重启nginx即可[root@iZ2ze80ru630hwydm2cnh5Z nginx]# service nginx restartStopping nginx:                                            [  OK  ]Starting nginx:                                            [  OK  ]
原创粉丝点击