由于官网文档坑太多,搭建个tp6失败,经过一番摸索,终于正常部署。Nginx环境来自于lnmp.org一键安装包
一、使用composer下载thinkphp6.0
[root@localhost tools]# cd /home/wwwroot/we.cn/
[root@localhost we.cn]# composer create-project topthink/think tp
二、进入open_dir跨目录,在lnmp1.7-full/tools目录执行
[root@localhost we.cn]# cd /opt/lnmp1.7-full/tools
[root@localhost tools]# ./emove_open_basedir_restriction.sh
输入网站根目录/home/wwwroot/we.cn/tp/public/
三、进入网站的应用根目录使用composer下载多应用模式模块
[root@localhost we.cn]# cd tp
[root@localhost tp]# composer require topthink/think-multi-app
四、进入app目录删除所有文件并使用php think build命令生成应用模块
[root@localhost tp]# cd app
[root@localhost app]# rm -rf *
[root@localhost app]# cd ../
[root@localhost tp]# php think build admin
SUCCESSED
[root@localhost tp]# php think build api
SUCCESSED
[root@localhost tp]# php think build home
SUCCESSED
五、使用composer下载think-swoole,并将swoole.php文件拷贝到config目录,并修改配置文件端口8080
[root@localhost tp]# composer require topthink/think-swoole
[root@localhost tp]# cp /home/wwwroot/we.cn/tp/vendor/topthink/think-swoole/src/config/swoole.php ./config
六、配置.env环境文件,开启APP_DEBUG模式并保存
[root@localhost tp]# mv .example.env .env
[root@localhost tp]# vim .env
APP_DEBUG = true
[APP]
DEFAULT_TIMEZONE = Asia/Shanghai
[LANG]
default_lang = zh-cn
七、启动swoole服务端
[root@localhost tp]# php think swoole
Starting swoole http server...
Swoole http server started: <http://127.0.0.1:8080>
You can exit with `CTRL-C`
正常启动