虚心使人进步

虚心学习,天天向上......
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

thinkphp 二级目录安装

Posted on 2020-04-18 09:22  Showker  阅读(1003)  评论(0编辑  收藏  举报

thinkphp 3.2 linux二级目录安装

2017.10.27 00:09:50字数 182阅读 433

详解:

注意:linux系统对大小写敏感

服务器系统:linux (阿里云服务器)

thinkphp 版本: 3.2

1. 修改nginx配置 (提示找不到控制器,页面空白等问题) 阿里云文件ftp位置:/etc/nginx/conf.d/default.conf

<span style="color: rgb(255, 102, 0);">注意:在Nginx低版本中,是不支持PATHINFO的,但是可以通过在Nginx.conf中配置转发规则实现(如果服务器支持pathinfo则不用以下代码):</span>

增加代码

(根目录下安装)

 location / { // …..省略部分代码
   if (!-e $request_filename) {
   rewrite  ^(.*)$  /index.php?s=$1  last;
   break;
    }
 }

(二级目录安装)

location /youdomain/ {
    if (!-e $request_filename){
        rewrite  ^/youdomain/(.*)$  /youdomain/index.php?s=$1  last;
    }
}

2.修改URL_MODEL连接模式

'URL_MODEL' =>'1', // config.php文件中

3.模板文件命名规范

goods_index.html 错误(linux系统对大小写敏感);Goods_index.html 正确