refactor(deploy): ?????????? Nginx ????
Made-with: Cursor
This commit is contained in:
15
restart.sh
15
restart.sh
@@ -236,7 +236,6 @@ fi
|
||||
|
||||
NGINX_DOMAIN="${NGINX_DOMAIN:-yuheng.yuxindazhineng.com}"
|
||||
NGINX_SSL_DIR="/etc/ssl/yh_web/$NGINX_DOMAIN"
|
||||
NGINX_CONF_NAME="${NGINX_DOMAIN}.conf"
|
||||
run_sudo mkdir -p "$NGINX_SSL_DIR"
|
||||
if [ -f "$ROOT/nginx/$NGINX_DOMAIN.pem" ] && [ -f "$ROOT/nginx/$NGINX_DOMAIN.key" ]; then
|
||||
run_sudo cp -f "$ROOT/nginx/$NGINX_DOMAIN.pem" "$NGINX_SSL_DIR/fullchain.pem"
|
||||
@@ -252,16 +251,14 @@ elif [ -f "$ROOT/nginx/$NGINX_DOMAIN/fullchain.pem" ] && [ -f "$ROOT/nginx/$NGIN
|
||||
run_sudo chmod 644 "$NGINX_SSL_DIR/fullchain.pem"
|
||||
run_sudo chmod 600 "$NGINX_SSL_DIR/privkey.pem" 2>/dev/null || true
|
||||
fi
|
||||
compose_cmd down 2>/dev/null || true
|
||||
compose_cmd up -d --force-recreate
|
||||
# shellcheck disable=SC1091
|
||||
. "$ROOT/scripts/lib-yh-compose-deploy.sh"
|
||||
yh_compose_down
|
||||
yh_compose_up
|
||||
|
||||
bash "$ROOT/scripts/run-promotion-import-on-deploy.sh" "$ROOT"
|
||||
|
||||
if [ -f "$ROOT/nginx/$NGINX_CONF_NAME" ]; then
|
||||
run_sudo cp -f "$ROOT/nginx/$NGINX_CONF_NAME" /etc/nginx/conf.d/ 2>/dev/null || true
|
||||
if run_sudo nginx -t 2>/dev/null; then
|
||||
run_sudo systemctl reload nginx 2>/dev/null && echo "Nginx 已重载." || true
|
||||
fi
|
||||
fi
|
||||
echo "宿主机 Nginx 站点(若 Nginx 已运行则更新并重载)..."
|
||||
yh_install_host_nginx_site_conf
|
||||
|
||||
echo "完成. 对外仅 443,反代: https://$NGINX_DOMAIN"
|
||||
|
||||
Reference in New Issue
Block a user