From 05ad119a1686bfa773c371c0ed74228e1e66259b Mon Sep 17 00:00:00 2001 From: yovinchen Date: Sun, 18 Feb 2024 23:35:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=89=8D=E7=AB=AF=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xlcs-admin/.env.development | 2 +- xlcs-admin/.env.production | 2 +- xlcs-admin/Dockerfile | 11 +++++++++++ xlcs-admin/nginx.conf | 21 +++++++++++++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 xlcs-admin/Dockerfile create mode 100644 xlcs-admin/nginx.conf diff --git a/xlcs-admin/.env.development b/xlcs-admin/.env.development index 3e1a4ef..8355d57 100644 --- a/xlcs-admin/.env.development +++ b/xlcs-admin/.env.development @@ -3,4 +3,4 @@ ENV = 'development' # base api # VUE_APP_BASE_API = '/dev-api' -VUE_APP_BASE_API = 'http://localhost:8200' +VUE_APP_BASE_API = 'http://192.168.31.67:8200' diff --git a/xlcs-admin/.env.production b/xlcs-admin/.env.production index 870addf..deda883 100644 --- a/xlcs-admin/.env.production +++ b/xlcs-admin/.env.production @@ -3,5 +3,5 @@ ENV = 'production' # base api #VUE_APP_BASE_API = '/prod-api' -VUE_APP_BASE_API = 'http://localhost:8200' +VUE_APP_BASE_API = 'http://192.168.31.67:8200' diff --git a/xlcs-admin/Dockerfile b/xlcs-admin/Dockerfile new file mode 100644 index 0000000..5be44f2 --- /dev/null +++ b/xlcs-admin/Dockerfile @@ -0,0 +1,11 @@ +FROM nginx:latest +EXPOSE 80 +WORKDIR /app +# 替换nginx配置 +COPY nginx.conf /etc/nginx/conf.d/default.conf +# 将第一阶段的静态文件复制到nginx中 +RUN rm -rf /usr/share/nginx/html +RUN mkdir /usr/share/nginx/html +COPY ./dist /usr/share/nginx/html + +CMD ["nginx", "-g", "daemon off;"] diff --git a/xlcs-admin/nginx.conf b/xlcs-admin/nginx.conf new file mode 100644 index 0000000..c480c0c --- /dev/null +++ b/xlcs-admin/nginx.conf @@ -0,0 +1,21 @@ +server { + listen 80; + listen [::]:80; + server_name localhost; + + access_log /var/log/nginx/host.access.log main; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + + # 新增下面这句,其他是默认nginx配置 + # 解决部分前端框架的路由问题,在浏览器刷新报错404 + try_files $uri $uri/ /index.html; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +}