-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.conf
56 lines (49 loc) · 1.67 KB
/
default.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
50
51
52
53
54
55
56
upstream server{
# 后端server 地址
server 127.0.0.1:8999;
}
server {
listen 80 default_server;
server_name _;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Host $server_name;
#charset koi8-r;
access_log /var/log/nginx/host.access.log main;
error_log /var/log/nginx/error.log error;
# gzip config.
gzip on;
gzip_min_length 1k;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript image/jpeg image/gif image/png application/json;
gzip_vary on;
### Config frontend static resource. Include default page,html resource no cache settings,static resource.
# default page.
location ~ ^/$ {
root /user/src/app/dist;
index index.html;
}
# set browser not to cache HTML resources.good for version update.
location ~* ^.+.(html)$ {
root /user/src/app/dist;
add_header Cache-Control no-cache;
}
# static resource.
location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|mp3|wav|bmp|rtf|js|flv|swf|map|ico|svg|woff2|woff|ttf|map)$ {
root /user/src/app/dist;
access_log off;
add_header Cache-Control max-age=31536000;
}
location / {
proxy_pass http://server;
}
error_page 500 502 503 504 50x.html;
location = 50x.html {
root html;
}
}