调整nginx配置
This commit is contained in:
parent
d42f970427
commit
70403cc450
@ -6,24 +6,21 @@ server {
|
|||||||
|
|
||||||
# Load configuration files for the default server block.
|
# Load configuration files for the default server block.
|
||||||
include /etc/nginx/default.d/*.conf;
|
include /etc/nginx/default.d/*.conf;
|
||||||
|
location ~* \.(js|css)$ {
|
||||||
|
# 缓存30天
|
||||||
|
add_header Cache-Control "public, max-age=2592000, immutable";
|
||||||
|
|
||||||
|
# 启用 Gzip 压缩
|
||||||
|
gzip on;
|
||||||
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||||
|
gzip_vary on;
|
||||||
|
}
|
||||||
location / {
|
location / {
|
||||||
# 此处的 @router 实际上是引用下面的转发,否则在 Vue 路由刷新时可能会抛出 404
|
# 此处的 @router 实际上是引用下面的转发,否则在 Vue 路由刷新时可能会抛出 404
|
||||||
try_files $uri $uri/ @router;
|
try_files $uri $uri/ @router;
|
||||||
# 请求指向的首页
|
# 请求指向的首页
|
||||||
index index.html;
|
index index.html;
|
||||||
}
|
}
|
||||||
location /console {
|
|
||||||
proxy_pass http://console.local.svc.cluster.local/console;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_connect_timeout 30s;
|
|
||||||
proxy_read_timeout 60s;
|
|
||||||
proxy_send_timeout 30s;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "Upgrade";
|
|
||||||
}
|
|
||||||
error_page 404 /404.html;
|
error_page 404 /404.html;
|
||||||
location = /404.html {
|
location = /404.html {
|
||||||
}
|
}
|
||||||
@ -31,4 +28,4 @@ server {
|
|||||||
error_page 500 502 503 504 /50x.html;
|
error_page 500 502 503 504 /50x.html;
|
||||||
location = /50x.html {
|
location = /50x.html {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user