多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
#### **登录`阿里云`并打开`控制台`** >提示:我们在这里以`阿里云`为例[https://www.aliyun.com/](https://www.aliyun.com/) ![](https://img.kancloud.cn/54/3e/543ecdaf13a32038080ed01e34721074_1366x657.png) #### **找到`云服务器ECS`并`进入`** ![](https://img.kancloud.cn/12/fb/12fb50b2124930976ac0364e3606c2f2_1166x574.png) #### **打开`实例`并打开`远程链接`** ![](https://img.kancloud.cn/4f/f0/4ff02e3cddbe34d9df126fda208531ac_1366x657.png) ![](https://img.kancloud.cn/e7/61/e7619abd3464aa06d603fe62632e5e70_1366x657.png) #### **输入root`密码`,点击`确定`** ![](https://img.kancloud.cn/13/52/13528535f69338b2cfbe13f01fa24adb_1366x657.png) #### **安装宝塔** >提示:我们这里使用的操作系统是CentOS8.4,这里根据你不同的操作系统选择不同的命令[https://www.bt.cn/download/linux.html](https://www.bt.cn/download/linux.html) ``` yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh ``` ![](https://img.kancloud.cn/8b/5a/8b5a9d285e5151c628de5fe89a46799d_1366x657.png) ![](https://img.kancloud.cn/01/0b/010b9fe958fab01d4c4a1e7eb282a758_1366x657.png) #### **安装完成复制登录地址和账号密码信息** ![](https://img.kancloud.cn/1a/e8/1ae8861e79394eefb2884a4478980cc6_1366x657.png) #### **代开登录地址并输入账号和密码进行登录** ![](https://img.kancloud.cn/e9/3b/e93b899231687535134054b3030702ab_1266x618.png) ![](https://img.kancloud.cn/89/c4/89c41dbe07cc72a38549e5da93eacca6_1366x657.png) #### **第一次打开需要登录`宝塔`的账号和密码,没有的可以去申请一个** ![](https://img.kancloud.cn/d4/e7/d4e7590f5c39e779d8c2173e8c6bec42_1366x657.png) #### **选择安装`LNMP`** > 这里安装可能需要一段时间,请耐心等待 ![](https://img.kancloud.cn/7c/26/7c268ca1e2bad57b6477976131d60682_1366x657.png) ![](https://img.kancloud.cn/da/85/da854bbd4d433669cea34f0135902940_1366x657.png) #### 打开`软件商店`,安装`Redis` ![](https://img.kancloud.cn/50/91/509133f3c600d741f30a6a643d2dafb2_1366x657.png) #### **设置`Redis密码`** ![](https://img.kancloud.cn/3d/91/3d917940054f5efcc0b2a186a184aa21_1366x657.png) #### 打开`软件商店`,安装`Linux工具箱` > 由于服务器比较小这样可以增加服务器的内存,下载需要重载服务器 ![](https://img.kancloud.cn/4f/49/4f49b72d6d805668fb4dc4801e332286_1366x657.png) ![](https://img.kancloud.cn/c9/39/c9399fbf2473805b8bd280bd5de95a92_1366x657.png) ![](https://img.kancloud.cn/57/53/5753b31a76fc68bc5bb670b5cc05695f_1366x657.png) #### 打开`软件商店`,安装`PHP7.3` ![](https://img.kancloud.cn/6c/67/6c67c76bd3372edbc6dbbaa826b664d6_1366x657.png) #### **配置阿里云`安全组`** ![](https://img.kancloud.cn/f0/37/f037bafc6e982d5305c9c2eca6c03828_1366x657.png) ![](https://img.kancloud.cn/36/a6/36a648b0d2919e015eda00e8298841fe_1366x657.png) #### **添加相应的安全组** ``` 自定义 TCP 目的: 6379/6379 源: 0.0.0.0/0 redis 自定义 TCP 目的: 888/888 源: 0.0.0.0/0 phpmyadmin访问端口 自定义 TCP 目的: 80/80 源: 0.0.0.0/0 网站访问端口 自定义 TCP 目的: 3306/3306 源: 0.0.0.0/0 mysql默认端口 自定义 TCP 目的: 21/21 源: 0.0.0.0/0 ftp端口 自定义 TCP 目的: 39000/40000 源: 0.0.0.0/0 ftp端口 自定义 TCP 目的: 443/443 源: 0.0.0.0/0 ssl证书 自定义 TCP 目的: 8888/8888 源: 0.0.0.0/0 宝塔登录 自定义 TCP 目的: 22/22 源: 0.0.0.0/0 ``` ![](https://img.kancloud.cn/73/16/7316334361b45dbd7d46b6c70849ce2c_1366x657.png) #### **配置宝塔安全组方向** ![](https://img.kancloud.cn/f2/34/f2348a216da5289614623387f1cf2cf4_1366x657.png) #### **安装MySql8.0** >提示:如果你的服务器大于2个CPU核心,那么可以直接下载,如果没有需要借助命令行进行下载,具体方法如下。 #### **大于2个CPU核心** ![](https://img.kancloud.cn/bb/89/bb8974c41bfc4918f150d7724e151c9e_1366x657.png) ![](https://img.kancloud.cn/fd/53/fd53845865bb5441abaf4c5a55a33406_1366x657.png) #### **小于2个CPU核心** ``` cd /www/server/panel/install wget http://download.bt.cn/install/1/mysql.sh bash mysql.sh install 8.0 ``` ![](https://img.kancloud.cn/87/83/87830abe508dfbbc218f5eed974b659d_1366x657.png) #### **.安装所需扩展`fileinfo`、`opcache`、`redis`、`imagemagick`、`imap`、`exif`、`intl`、`xsl`。** ![](https://img.kancloud.cn/74/4a/744a04d0ad000590ac3fcf5035b3486a_1366x657.png) #### **删除相关禁用PHP禁用函数`putenv()` 、 `pcntl_signal()` 、 `proc_open()`,`symlink()`,`pcntl_alarm()`** ![](https://img.kancloud.cn/bc/dd/bcdd9a60a97afc03233a3ad5201be3ba_1366x657.png) #### **远程链接查看`php版本`** ``` php -v ``` >提示:如果php版本不是7.3,需要重新设置php版本 ``` 首先删除PHP默认版本 rm -f /usr/bin/php 将默认版本改成73 ln -sf /www/server/php/73/bin/php /usr/bin/php ``` #### **安装`GIT`** ``` yum -y install git git --version git config --global user.email "邮箱" git config --global user.name "姓名" #生成ssh ssh-keygen -t rsa -C "邮箱" # 查看你的 public key 将它添加到码云 cat ~/.ssh/id_rsa.pub # 查看是否完成 ssh -T git@gitee.com ``` #### **在阿里云创建域名** ![](https://img.kancloud.cn/d6/36/d6362e5092716b3b9c722d3f4ccef54f_1366x657.png) ![](https://img.kancloud.cn/cd/9a/cd9a26d3acea6fbd225f5960966152bf_1366x657.png) #### **在宝塔创建网站** ![](https://img.kancloud.cn/ca/5f/ca5fef54f65d40b003c9b871d0098776_1366x657.png) ![](https://img.kancloud.cn/2a/51/2a514cc57a6c243147228951720e780f_1366x657.png) #### **下载项目** ``` cd /www/wwwroot # cs.lvacms.cn 表示生成文件夹名称 git clone git@gitee.com:song-bo/lva-cms2.0.git cs.lvacms.cn # 切换到服务端根目录 cd cs.lvacms.cn/server # 安装扩展 composer install # 生成 env 文件 cp .env.example .env # 生成laravel的key php artisan key:generate # 生成jwt-auth的key php artisan jwt:secret # 在.env文件配置mysql数据库和redis密码 # 执行数据库迁移 php artisan module:migrate # 执行数据库填充 php artisan module:seed # 生成图片快捷方式 php artisan storage:link # 修改env文件 QUEUE_CONNECTION=database ``` #### **配置`server`网站目录** ![](https://img.kancloud.cn/9a/f3/9af35df49116d93b0f4a28641004d640_1366x657.png) #### **配置`server`伪静态** ``` location / { try_files $uri $uri/ /index.php$is_args$query_string; } ``` ![](https://img.kancloud.cn/bf/5e/bf5efc96a84ffb5b13a23d26f4effcc6_1366x657.png) 配置`admin` 代理 ``` location /api { include uwsgi_params; proxy_pass 'http://csserver.lvacms.cn/api'; } proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; ``` ![](https://img.kancloud.cn/7e/fa/7efa90254a5d8701590449654fa82d60_1366x657.png)