update
This commit is contained in:
parent
e49ca0712a
commit
6a0633a75d
@ -39,8 +39,8 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
|||||||
# 复制构建结果到Nginx目录
|
# 复制构建结果到Nginx目录
|
||||||
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
# 复制自定义Nginx配置(可选)
|
# 复制Nginx配置文件
|
||||||
# COPY nginx.conf /etc/nginx/conf.d/default.conf
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
# 暴露80端口
|
# 暴露80端口
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|||||||
12
nginx.conf
12
nginx.conf
@ -9,12 +9,6 @@ server {
|
|||||||
gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml;
|
gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml;
|
||||||
gzip_vary on;
|
gzip_vary on;
|
||||||
|
|
||||||
# 资源文件缓存
|
|
||||||
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
expires 1d;
|
|
||||||
}
|
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
index index.html index.htm;
|
index index.html index.htm;
|
||||||
@ -22,6 +16,12 @@ server {
|
|||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 缓存静态资源
|
||||||
|
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
expires 1d;
|
||||||
|
}
|
||||||
|
|
||||||
# 错误页面
|
# 错误页面
|
||||||
error_page 500 502 503 504 /50x.html;
|
error_page 500 502 503 504 /50x.html;
|
||||||
location = /50x.html {
|
location = /50x.html {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user