完善前端后台部署

This commit is contained in:
yovinchen 2024-02-18 23:35:23 +08:00
parent 53b66a63d0
commit 05ad119a16
4 changed files with 34 additions and 2 deletions

View File

@ -3,4 +3,4 @@ ENV = 'development'
# base api # base api
# VUE_APP_BASE_API = '/dev-api' # VUE_APP_BASE_API = '/dev-api'
VUE_APP_BASE_API = 'http://localhost:8200' VUE_APP_BASE_API = 'http://192.168.31.67:8200'

View File

@ -3,5 +3,5 @@ ENV = 'production'
# base api # base api
#VUE_APP_BASE_API = '/prod-api' #VUE_APP_BASE_API = '/prod-api'
VUE_APP_BASE_API = 'http://localhost:8200' VUE_APP_BASE_API = 'http://192.168.31.67:8200'

11
xlcs-admin/Dockerfile Normal file
View File

@ -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;"]

21
xlcs-admin/nginx.conf Normal file
View File

@ -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;
}
}