波斯汪
nginx不支持thinkphp的原因1ThinkPHP支持通过PATHINFO和URL rewrite的方式来提供友好的URL,只需要在配置文件中设置 'URL_MODEL' => 2 即可。在Apache下只需要开启mod_rewrite模块就可以正常访问了,但是Nginx中默认是不支持PATHINFO的,所以nginx默认情况下是不支持thinkphp的。不过我们可以通过修改nginx的配置文件来让其支持thinkphp。让nginx支持pathinfo,支持thinkphp1我们打开nginx的配置文件,如果是想某个站点支持,请打开对应站点的配置文件如何让nginx支持ThinkPHP框架2我们注释掉配置文件中那些被我圈出来的语句(location ~ \.php$ {……}这一段里面的),我们将对这部分进行重写!如何让nginx支持ThinkPHP框架3将重写后的代码添加进去。如何让nginx支持ThinkPHP框架4添加的代码如下:.........................................location / {if (!-e $request_filename) {rewrite ^/(.*)$ /index.php/$1 last;break;}}location ~ \.php {fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;include fcgi.conf;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;}