-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
110 lines (87 loc) · 3.19 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
server {
set_by_lua $WWWROOT_DIR 'return os.getenv("WWWROOT_DIR")';
server_name
amp.jiandansousuo.com
mip.jiandansousuo.com
jiandansousuo.com
www.jiandansousuo.com
jiandansousuo.cn
www.jiandansousuo.cn
jiandansousuo.org
www.jiandansousuo.org;
include inc/ssl.conf;
ssl_certificate ca/jiandansousuo.com/fullchain.cer;
ssl_certificate_key ca/jiandansousuo.com/jiandansousuo.com.key;
if ( $host != 'jiandansousuo.com' ){
rewrite ^/(.*)$ https://jiandansousuo.com/$1 permanent;
}
error_page 404 500 =404 /404.html;
# 使用location来匹配以字体文件
location ~* \.(eot|otf|ttf|woff|svg)$ {
add_header Access-Control-Allow-Origin *;
}
root $WWWROOT_DIR/jiandansousuo.com;
# 上报日志
access_log syslog:server=kibana-fluentd:8989,tag=jiandansousuo_com Fluentd;
error_log syslog:server=kibana-fluentd:8988,tag=jiandansousuo_com error;
}
# demo.jiandansousuo.com
server {
set_by_lua $WWWROOT_DIR 'return os.getenv("WWWROOT_DIR")';
server_name demo.jiandansousuo.com;
root $WWWROOT_DIR/demo.jiandansousuo.com;
include inc/ssl.conf;
ssl_certificate ca/jiandansousuo.com/fullchain.cer;
ssl_certificate_key ca/jiandansousuo.com/jiandansousuo.com.key;
# 使用location来匹配以字体文件
location ~* \.(eot|otf|ttf|woff|svg)$ {
add_header Access-Control-Allow-Origin *;
}
location = /favicon.ico {
add_header 'cache-control' 'max-age=86400';
root $WWWROOT_DIR/jiandansousuo.com;
}
# 上报日志
access_log syslog:server=kibana-fluentd:8989,tag=demo_jiandansousuo_com Fluentd;
error_log syslog:server=kibana-fluentd:8988,tag=demo_jiandansousuo_com error;
}
# https://*.jiandansousuo.com -> 403
server {
server_name *.jiandansousuo.com;
include inc/ssl.conf;
ssl_certificate ca/jiandansousuo.com/fullchain.cer;
ssl_certificate_key ca/jiandansousuo.com/jiandansousuo.com.key;
include inc/favicon.conf;
include inc/robots.disallow.conf;
# 上报日志
access_log syslog:server=kibana-fluentd:8989,tag=jiandansousuo_com_default Fluentd;
error_log syslog:server=kibana-fluentd:8988,tag=jiandansousuo_com_default error;
location / {
return 403;
}
}
# https cn,org -> https://*.jiandansousuo.com
server {
server_name ~^(?<sub>[\w-]+)\.jiandansousuo.(cn|org)$;
include inc/ssl.conf;
ssl_certificate ca/jiandansousuo.com/fullchain.cer;
ssl_certificate_key ca/jiandansousuo.com/jiandansousuo.com.key;
location / {
rewrite ^/(.*)$ https://$sub.jiandansousuo.com/$1 permanent;
}
}
# http://jiandansousuo.* -> https://jiandansousuo.*;
server {
listen 80;
server_name
jiandansousuo.com
*.jiandansousuo.com
jiandansousuo.cn
*.jiandansousuo.cn
jiandansousuo.org
*.jiandansousuo.org;
location / {
include inc/sts.conf;
rewrite ^/(.*)$ https://$host/$1 permanent;
}
}