ZBLOG

我的项目名字是sky_take_out Gitee的地址https://gitee.com/wjqqjw/sky_take_out.git 据此写一个centos自动化部署脚本

#!/bin/bash

Set variables

APP_NAME=“sky_take_out” APP_GIT_URL=”https://gitee.com/wjqqjw/sky_take_out.git” APP_DIR=“/var/www/\({APP_NAME}" NGINX_CONF_FILE="/etc/nginx/sites-available/\){APP_NAME}.conf” NGINX_SYMLINK_FILE=“/etc/nginx/sites-enabled/${APP_NAME}.conf”

echo “Starting deployment process for ${APP_NAME}”

Install git and nginx

sudo yum update -y sudo yum install git nginx -y

Clone the repository

sudo mkdir -p \({APP_DIR} cd \){APP_DIR} sudo git clone ${APP_GIT_URL} .

Install dependencies

sudo npm install

Build the project

sudo npm run build

Create Nginx configuration file

sudo tee ${NGINX_CONF_FILE} > /dev/null <

listen 80;
server_name localhost;

root ${APP_DIR}/build;

index index.html;

location / {
    try_files \$uri /index.html;
}

} EOF

Create symlink to enable site in Nginx

sudo ln -s \({NGINX_CONF_FILE} \){NGINX_SYMLINK_FILE}

Restart Nginx service

sudo systemctl restart nginx

echo “Deployment process for ${APP_NAME} completed successfully!”

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=1784

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?