forked from maogugu/vue-template-element
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
49 lines (47 loc) · 1.26 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
## nginx 配置说明文件
server {
# 监听端口 TODO 可能要改
listen 80;
# 监听IP _ 代表 0.0.0.0/0
server_name _;
# 最大上传 100M
client_max_body_size 100m;
# 开启gzip
gzip_static on;
gzip_types text/css text/javascript;
# path 路径
# TODO 修改
root /server/manager/;
# index 文件名
index index.html;
# 静态文件类型处理 适用于 外部没有引入 minType 文件
location ~ \.css {
add_header Content-Type text/css;
}
location ~ \.js {
add_header Content-Type application/x-javascript;
}
# 主页文件不走缓存 单独处理
location /index.html{
# 开启 etag 每次都获取最新
etag on;
}
# spa 模式启动
location / {
# 支持 路由模式 可不用hash
try_files $uri $uri/ /index.html;
## 走缓存 冗余配置
etag off;
# 资源文件有 hash 后缀 最长时间缓存
add_header Cache-Control "max-age=31536000, immutable";
expires max;
}
# TODO 代理接口API
location /bscnym {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# TODO change 代理地址
proxy_pass http://127.0.0.1:9000;
}
}