修改流浪切换方式

This commit is contained in:
zk
2026-05-27 16:29:37 +08:00
parent 42768cc4c5
commit b666f0047d
2 changed files with 2 additions and 11 deletions
Vendored
+1 -1
View File
@@ -166,7 +166,7 @@ pipeline {
stage('切换流量') { stage('切换流量') {
steps { steps {
script { 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'" sh "${SSH_CMD} 'docker exec ${CONTAINER_PREFIX}-nginx nginx -s reload'"
echo "✅ 流量已切换到 ${env.DEPLOY_TARGET}" echo "✅ 流量已切换到 ${env.DEPLOY_TARGET}"
} }
+1 -10
View File
@@ -23,15 +23,6 @@ http {
# 请求体大小限制 # 请求体大小限制
client_max_body_size 20m; client_max_body_size 20m;
# 蓝绿 upstream
upstream blue {
server offerpie-web-blue:80;
}
upstream green {
server offerpie-web-green:80;
}
server { server {
listen 80; listen 80;
server_name _; server_name _;
@@ -74,7 +65,7 @@ http {
# 前端静态文件(蓝绿切换,默认 blue,部署时 sed 切换) # 前端静态文件(蓝绿切换,默认 blue,部署时 sed 切换)
location / { location / {
proxy_pass http://blue; proxy_pass http://blue:80;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;