chore: 部署位置变更为/mobile
This commit is contained in:
parent
bdc282c0bf
commit
3125a1e994
2
.env
2
.env
|
|
@ -1,4 +1,4 @@
|
||||||
VITE_APP_PUBLIC_PATH=/
|
VITE_APP_PUBLIC_PATH=/mobile/
|
||||||
VITE_APP_PREVIEW=true
|
VITE_APP_PREVIEW=true
|
||||||
VITE_APP_API_BASE_URL=/api
|
VITE_APP_API_BASE_URL=/api
|
||||||
VITE_APP_OUT_DIR=dist
|
VITE_APP_OUT_DIR=dist
|
||||||
|
|
|
||||||
22
Dockerfile
22
Dockerfile
|
|
@ -1,17 +1,21 @@
|
||||||
FROM nginx:1.25.3-alpine
|
FROM nginx:1.25.3-alpine
|
||||||
|
|
||||||
LABEL "authors"="suguo.yao"
|
LABEL authors="suguo.yao"
|
||||||
LABEL "email"="ysg@myschools.me"
|
LABEL email="ysg@myschools.me"
|
||||||
|
|
||||||
ENV TZ=Asia/Shanghai \
|
ENV TZ=Asia/Shanghai \
|
||||||
LANG=C.UTF-8 \
|
LANG=C.UTF-8 \
|
||||||
APP_DIR=/usr/share/nginx/html
|
APP_DIR=/usr/share/nginx/html
|
||||||
|
|
||||||
COPY dist/. ${APP_DIR}
|
# 创建目标目录并复制构建产物
|
||||||
|
RUN mkdir -p ${APP_DIR}/mobile
|
||||||
|
COPY dist/. ${APP_DIR}/mobile/
|
||||||
|
|
||||||
WORKDIR ${APP_DIR}
|
# 用自定义Nginx配置覆盖默认配置
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
# 设置时区
|
||||||
|
RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime \
|
||||||
|
&& echo ${TZ} > /etc/timezone
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime \
|
|
||||||
&& echo ${TZ} > /etc/timezone
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
location /mobile {
|
||||||
|
# 关键配置:指向构建产物的物理路径
|
||||||
|
alias /usr/share/nginx/html/mobile;
|
||||||
|
|
||||||
|
# 处理Vue路由的HTML5 History模式
|
||||||
|
try_files $uri $uri/ /mobile/index.html;
|
||||||
|
|
||||||
|
# 确保正确识别文件类型
|
||||||
|
types {
|
||||||
|
text/html html;
|
||||||
|
application/javascript js;
|
||||||
|
text/css css;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# 可选:重定向根路径到/mobile(按需启用)
|
||||||
|
# location = / {
|
||||||
|
# return 301 /mobile;
|
||||||
|
# }
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue