一键应用后台安装出错解决方案

  1. PHP 版本不低于 PHP5.6,推荐使用 PHP7 以达到最优效果;
  2. 需开启 PATHINFO,不再支持 ThinkPHP 的 URL 兼容模式运行(源于如何优雅的展示)。


URL重写

可以通过URL重写隐藏应用的入口文件index.php(也可以是其它的入口文件,但URL重写通常只能设置一个入口文件),下面是相关服务器的配置参考:

[ Apache ]


  Options +FollowSymlinks -Multiviews
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]


[ IIS ]

如果你的服务器环境支持ISAPI_Rewrite的话,可以配置httpd.ini文件,添加下面的内容:

 
RewriteRule (.*)$ /index\.php\?s=$1 [I]
在IIS的高版本下面可以配置web.Config,在中间添加rewrite节点:


 
 
 
 
 
 
 
 
 
 
 
 

[ Nginx ]

在Nginx低版本中,是不支持PATHINFO的,但是可以通过在Nginx.conf中配置转发规则实现:

 
location / {  
		        index  index.htm index.html index.php;  
		        #访问路径的文件不存在则重写URL转交给ThinkPHP处理  
		        if (!-e $request_filename) {  
		           rewrite  ^/(.*)$  /index.php/$1  last;  
		           break;  
		        }  
		    }