From e5be1bebe9323020a4c3cfb94445904f0be18952 Mon Sep 17 00:00:00 2001 From: clay <20932067@zju.edu.cn> Date: Tue, 8 Oct 2024 14:23:37 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20nginx.conf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx.conf | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nginx.conf b/nginx.conf index a9e94c9..7b3267f 100644 --- a/nginx.conf +++ b/nginx.conf @@ -29,6 +29,20 @@ http { listen 80; listen [::]:80; + + location /api { + proxy_pass http://smartopsserver:8080; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Port $server_port; + proxy_set_header Host $host; + rewrite "^/api/(.*)$" /$1 break; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + client_max_body_size 30m; + } + location / { root /home/clay; index index.html index.htm; From 52af20bec88a4f2cc639e113091281c25978cbfb Mon Sep 17 00:00:00 2001 From: clay <20932067@zju.edu.cn> Date: Tue, 8 Oct 2024 14:24:30 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20docker.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker.sh b/docker.sh index 8a5db81..1b0153e 100644 --- a/docker.sh +++ b/docker.sh @@ -12,5 +12,5 @@ docker rmi smartopsweb:latest echo '----build image start----' docker build -t smartopsweb:latest . echo '----build image success----' -docker run --name smartopsweb --restart=always -d -p 28081:80 smartopsweb:latest +docker run --name smartopsweb --link smartopsserver --restart=always -d -p 28081:80 smartopsweb:latest