CentOS7 系统使用 Git 部署 ThinkPHP5.1 框架

ThinkPHP(简称 TP)是国内最主流、最普及的轻量级 PHP 开源 Web 开发框架,以快速开发、中文友好、简单易用著称。

官网:https://www.thinkphp.cn/


安装与初始化配置


命令

[rover@localhost ~]$ su -
[root@localhost web]# cd /var
[root@localhost var]# mkdir web
[root@localhost var]# cd web

[root@localhost web]# git clone https://gitee.com/liu21st/thinkphp.git tp5
[root@localhost web]# cd tp5
[root@localhost tp5]# git checkout 5.1
[root@localhost tp5]# git clone https://gitee.com/liu21st/framework.git thinkphp
[root@localhost tp5]# cd thinkphp
[root@localhost thinkphp]# git checkout 5.1

[root@localhost thinkphp]# vim /usr/local/nginx/conf/vhosts/tp5.local.com.conf
server{
 listen 80;
 server_name tp5.local.com;
 root /var/web/tp5/public;
 location / {
        index  index.html index.htm index.php;
        #autoindex  on;
             
        if (!-e $request_filename) {
   rewrite  ^(.*)$ /index.php?s=/$1 last;
  }
    }
 
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|ico)$
 {
  expires 30d;
  access_log off;
 }
 
 location ~ .*\.(js|css)?$
 {
  expires       max;
  log_not_found off;
  access_log    off;
 }
 
 error_page   500 502 503 504  /50x.html;
 
 location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        include        fastcgi_params;
    }
}
[root@localhost ~]# systemctl reload nginx
[root@localhost ~]# echo "127.0.0.1 tp5.local.com" >> /etc/hosts
分类:ThinkPHP 标签: LNMP环境 linux web ThinkPHP5.1
作者头像

作者: rover

后端开发工程师,热爱Web技术。有多年开发经验,喜欢分享知识和经验。