更新配置2
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
FROM harbor.zgitm.com/library/nginx:alpine
|
FROM harbor.zgitm.com/library/nginx:alpine
|
||||||
COPY dist/ /usr/share/nginx/html/
|
COPY dist/ /usr/share/nginx/html/
|
||||||
|
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
52
mokee-gateway-web/nginx/nginx.conf
Normal file
52
mokee-gateway-web/nginx/nginx.conf
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
# ==========================================
|
||||||
|
# Vue 项目 Nginx 配置模板
|
||||||
|
# 配合 Dockerfile.vue 使用
|
||||||
|
# ==========================================
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
# 日志格式
|
||||||
|
access_log /var/log/nginx/access.log;
|
||||||
|
error_log /var/log/nginx/error.log;
|
||||||
|
|
||||||
|
# 站点根目录
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
# 静态资源长期缓存
|
||||||
|
location /assets/ {
|
||||||
|
expires 30d;
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Vue Router history 模式支持
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
# API 代理(如果有后端代理需求,可在此配置)
|
||||||
|
# location /api/ {
|
||||||
|
# proxy_pass http://backend-server:8080/;
|
||||||
|
# proxy_set_header Host $host;
|
||||||
|
# proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
# }
|
||||||
|
|
||||||
|
# Gzip 压缩
|
||||||
|
gzip on;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_comp_level 6;
|
||||||
|
gzip_types
|
||||||
|
text/plain
|
||||||
|
text/css
|
||||||
|
text/xml
|
||||||
|
text/javascript
|
||||||
|
application/json
|
||||||
|
application/javascript
|
||||||
|
application/xml+rss
|
||||||
|
application/x-javascript
|
||||||
|
image/svg+xml;
|
||||||
|
gzip_min_length 1024;
|
||||||
|
gzip_proxied any;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user