Commit 638ae3fc by 李辉02

feat(将nginx挂载出来): web

parent 151c5a8b
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Chart.Name }}-config
namespace: {{ .Values.global.app.namespace }}
data:
nginx.conf: |
server {
listen 80;
server_name localhost;
# 开启 gzip 压缩
gzip on;
gzip_min_length 1k;
gzip_comp_level 6;
gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
# 根目录配置
location / {
root /usr/share/nginx/html;
index index.html index.htm;
# 支持 SPA 单页应用,所有请求都返回 index.html
try_files $uri $uri/ /index.html;
}
# 静态资源缓存配置
location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
root /usr/share/nginx/html;
expires 7d;
add_header Cache-Control "public, immutable";
}
# 禁止访问 .htaccess 等隐藏文件
location ~ /\. {
deny all;
}
# 错误页面
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
......@@ -26,3 +26,11 @@ spec:
name: http
resources:
{{- include "app.resources" . | nindent 12 }}
volumeMounts:
- name: nginx-config
mountPath: /etc/nginx/conf.d/default.conf
subPath: nginx.conf
volumes:
- name: nginx-config
configMap:
name: {{ .Chart.Name }}-config
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment