-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathwww.smartmiao.com.conf
248 lines (221 loc) · 11 KB
/
www.smartmiao.com.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
server {
# 根目录已经有个default了
# listen 80 default_server;
# listen [::]:80 default_server;
listen 80;
listen [::]:80;
server_name www.smartmiao.com smartmiao.com;
# 重定向所有HTTP网站访问以使用HTTPS
return 301 https://$host$request_uri;
}
server {
# 指定ssl监听端口
listen 443 ssl http2;
listen [::]:443 ssl http2;
# 证书绑定的域名,例如:www.example.com、localhost
server_name www.smartmiao.com;
# 指定服务器证书路径
ssl_certificate /etc/nginx/ssl/www.smartmiao.com/smartmiao/www.smartmiao.com_bundle.pem;
# 指定私钥证书路径
ssl_certificate_key /etc/nginx/ssl/www.smartmiao.com/smartmiao/www.smartmiao.com.key;
# 配置会话缓存为10m,大约40000个session
ssl_session_cache shared:SSL:10m;
# 配置会话缓存超时时间为1天
ssl_session_timeout 1d;
# 禁用会话重用
ssl_session_tickets off;
# DHE密码器的Diffie-Hellman参数, 推荐 2048 位
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
# 指定SSL服务器端支持的协议版本
# ssl_protocols TLSv1.2 TLSv1.3;
ssl_protocols TLSv1.2;
# 指定加密算法
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
# 在使用SSLv3和TLS协议时指定服务器的加密算法要优先于客户端的加密算法
ssl_prefer_server_ciphers on;
# 使用严格传输策略HSTS。当浏览器从HTTPS网站看到此标头时,它“获悉”只能使用HTTPS(SSL或TLS)访问该域。它会在max-age一段时间内(通常为31,536,000秒,大约等于1年)缓存此信息
# includeSubDomains参数告诉浏览器HSTS策略也适用于当前域的所有子域,always参数确保为所有响应(包括内部生成的错误响应)设置标头
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# 启用ssl OCSP stapling功能, 服务端主动查询OCSP结果, 提高TLS握手效率
ssl_stapling on;
# 开启OCSP stapling 验证
ssl_stapling_verify on;
# 使用根CA和中级证书验证OCSP响应的信任链
ssl_trusted_certificate /etc/nginx/ssl/www.smartmiao.com/smartmiao/www.smartmiao.com_bundle.pem;
# replace with the IP address of your resolver
# resolver 127.0.0.1;
# 匹配请求
location / {
# 设置客户端真实的域名(包括端口号)
proxy_set_header Host $host;
# 设置客户端或上一级代理IP
proxy_set_header X-Real-IP $remote_addr;
# 设置客户端或上一级端口
proxy_set_header X-Real-Port $remote_port;
# 设置在多层代理时会包含真实客户端及中间每个代理服务器的IP
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 设置客户端真实的协议(http还是https)
proxy_set_header X-Forwarded-Proto $scheme;
# 设置代理服务访问地址
# proxy_pass http://127.0.0.1:7060;
# 静态资源代理
root /var/www/html/www.smartmiao.com/smartmiao;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
}
server {
listen 80;
server_name 2019.smartmiao.com;
location / {
root /var/www/html/www.smartmiao.com/PersonalWebsite-2019/html;
index index.html index.htm;
}
}
server {
listen 80;
server_name 2018.smartmiao.com;
location / {
root /var/www/html/www.smartmiao.com/PersonalWebsite-2018/html;
index index.html index.htm;
}
}
server {
listen 80;
server_name 2017.smartmiao.com;
location / {
root /var/www/html/www.smartmiao.com/PersonalWebsite-2017/html;
index index.html index.htm;
}
}
server {
# 指定ssl监听端口
listen 443 ssl http2;
listen [::]:443 ssl http2;
# 证书绑定的域名,例如:www.example.com、localhost
server_name demo.smartmiao.com;
# 指定服务器证书路径
ssl_certificate /etc/nginx/ssl/www.smartmiao.com/smartmiao-demo/demo.smartmiao.com_bundle.pem;
# 指定私钥证书路径
ssl_certificate_key /etc/nginx/ssl/www.smartmiao.com/smartmiao-demo/demo.smartmiao.com.key;
# 配置会话缓存为10m,大约40000个session
ssl_session_cache shared:SSL:10m;
# 配置会话缓存超时时间为1天
ssl_session_timeout 1d;
# 禁用会话重用
ssl_session_tickets off;
# DHE密码器的Diffie-Hellman参数, 推荐 2048 位
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
# 指定SSL服务器端支持的协议版本
# ssl_protocols TLSv1.2 TLSv1.3;
ssl_protocols TLSv1.2;
# 指定加密算法
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
# 在使用SSLv3和TLS协议时指定服务器的加密算法要优先于客户端的加密算法
ssl_prefer_server_ciphers on;
# 使用严格传输策略HSTS。当浏览器从HTTPS网站看到此标头时,它“获悉”只能使用HTTPS(SSL或TLS)访问该域。它会在max-age一段时间内(通常为31,536,000秒,大约等于1年)缓存此信息
# includeSubDomains参数告诉浏览器HSTS策略也适用于当前域的所有子域,always参数确保为所有响应(包括内部生成的错误响应)设置标头
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# 启用ssl OCSP stapling功能, 服务端主动查询OCSP结果, 提高TLS握手效率
ssl_stapling on;
# 开启OCSP stapling 验证
ssl_stapling_verify on;
# 使用根CA和中级证书验证OCSP响应的信任链
ssl_trusted_certificate /etc/nginx/ssl/www.smartmiao.com/smartmiao-demo/demo.smartmiao.com_bundle.pem;
# replace with the IP address of your resolver
# resolver 127.0.0.1;
# 匹配请求
location / {
# 设置客户端真实的域名(包括端口号)
proxy_set_header Host $host;
# 设置客户端或上一级代理IP
proxy_set_header X-Real-IP $remote_addr;
# 设置客户端或上一级端口
proxy_set_header X-Real-Port $remote_port;
# 设置在多层代理时会包含真实客户端及中间每个代理服务器的IP
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 设置客户端真实的协议(http还是https)
proxy_set_header X-Forwarded-Proto $scheme;
# 设置代理服务访问地址
# proxy_pass http://127.0.0.1:7060;
# 静态资源代理
root /var/www/html/www.smartmiao.com/smartmiao-demo/web;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /frontend {
# 设置客户端真实的域名(包括端口号)
proxy_set_header Host $host;
# 设置客户端或上一级代理IP
proxy_set_header X-Real-IP $remote_addr;
# 设置客户端或上一级端口
proxy_set_header X-Real-Port $remote_port;
# 设置在多层代理时会包含真实客户端及中间每个代理服务器的IP
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 设置客户端真实的协议(http还是https)
proxy_set_header X-Forwarded-Proto $scheme;
# 设置代理服务访问地址
# proxy_pass http://127.0.0.1:7060;
# 静态资源代理
# root /var/www/html/www.smartmiao.com/smartmiao-demo/frontend;
alias /var/www/html/www.smartmiao.com/smartmiao-demo/frontend;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
}
server {
# 指定ssl监听端口
listen 443 ssl http2;
listen [::]:443 ssl http2;
# 证书绑定的域名,例如:www.example.com、localhost
server_name services.smartmiao.com;
# 指定服务器证书路径
ssl_certificate /etc/nginx/ssl/www.smartmiao.com/services/services.smartmiao.com_bundle.pem;
# 指定私钥证书路径
ssl_certificate_key /etc/nginx/ssl/www.smartmiao.com/services/services.smartmiao.com.key;
# 配置会话缓存为10m,大约40000个session
ssl_session_cache shared:SSL:10m;
# 配置会话缓存超时时间为1天
ssl_session_timeout 1d;
# 禁用会话重用
ssl_session_tickets off;
# DHE密码器的Diffie-Hellman参数, 推荐 2048 位
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
# 指定SSL服务器端支持的协议版本
# ssl_protocols TLSv1.2 TLSv1.3;
ssl_protocols TLSv1.2;
# 指定加密算法
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
# 在使用SSLv3和TLS协议时指定服务器的加密算法要优先于客户端的加密算法
ssl_prefer_server_ciphers on;
# 使用严格传输策略HSTS。当浏览器从HTTPS网站看到此标头时,它“获悉”只能使用HTTPS(SSL或TLS)访问该域。它会在max-age一段时间内(通常为31,536,000秒,大约等于1年)缓存此信息
# includeSubDomains参数告诉浏览器HSTS策略也适用于当前域的所有子域,always参数确保为所有响应(包括内部生成的错误响应)设置标头
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# 启用ssl OCSP stapling功能, 服务端主动查询OCSP结果, 提高TLS握手效率
ssl_stapling on;
# 开启OCSP stapling 验证
ssl_stapling_verify on;
# 使用根CA和中级证书验证OCSP响应的信任链
ssl_trusted_certificate /etc/nginx/ssl/www.smartmiao.com/services/services.smartmiao.com_bundle.pem;
# replace with the IP address of your resolver
# resolver 127.0.0.1;
# 匹配请求
location / {
# 设置客户端真实的域名(包括端口号)
proxy_set_header Host $host;
# 设置客户端或上一级代理IP
proxy_set_header X-Real-IP $remote_addr;
# 设置客户端或上一级端口
proxy_set_header X-Real-Port $remote_port;
# 设置在多层代理时会包含真实客户端及中间每个代理服务器的IP
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 设置客户端真实的协议(http还是https)
proxy_set_header X-Forwarded-Proto $scheme;
# 设置代理服务访问地址
proxy_pass http://127.0.0.1:7001;
# 静态资源代理
# root /var/www/html/www.smartmiao.com/smartmiao-demo;
# try_files $uri $uri/ /index.html;
# index index.html index.htm;
}
}