From b666f0047d3bfef77af971b27d535b81dcf84b89 Mon Sep 17 00:00:00 2001 From: zk Date: Wed, 27 May 2026 16:29:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=81=E6=B5=AA=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 2 +- proxy_nginx.conf | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b6a1e2d..22dcee1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -166,7 +166,7 @@ pipeline { stage('切换流量') { steps { script { - sh "${SSH_CMD} \"sed -i 's/proxy_pass http:\\/\\/\\(blue\\|green\\);/proxy_pass http:\\/\\/${env.DEPLOY_TARGET};/' ${REMOTE_DIR}/proxy_nginx.conf\"" + sh "${SSH_CMD} \"sed -i 's/proxy_pass http:\\/\\/\\(blue\\|green\\):80;/proxy_pass http:\\/\\/${env.DEPLOY_TARGET}:80;/' ${REMOTE_DIR}/proxy_nginx.conf\"" sh "${SSH_CMD} 'docker exec ${CONTAINER_PREFIX}-nginx nginx -s reload'" echo "✅ 流量已切换到 ${env.DEPLOY_TARGET}" } diff --git a/proxy_nginx.conf b/proxy_nginx.conf index 0b3db39..18d26de 100644 --- a/proxy_nginx.conf +++ b/proxy_nginx.conf @@ -23,15 +23,6 @@ http { # 请求体大小限制 client_max_body_size 20m; - # 蓝绿 upstream - upstream blue { - server offerpie-web-blue:80; - } - - upstream green { - server offerpie-web-green:80; - } - server { listen 80; server_name _; @@ -74,7 +65,7 @@ http { # 前端静态文件(蓝绿切换,默认 blue,部署时 sed 切换) location / { - proxy_pass http://blue; + proxy_pass http://blue:80; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr;