-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
73 lines (55 loc) · 2.05 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
server {
set_by_lua $WWWROOT_DIR 'return os.getenv("WWWROOT_DIR")';
server_name apijs.org www.apijs.org apijs.net www.apijs.net;
include inc/ssl.conf;
ssl_certificate ca/apijs.org/fullchain.cer;
ssl_certificate_key ca/apijs.org/apijs.org.key;
if ( $host != 'apijs.org' ){
rewrite ^/(.*)$ https://apijs.org/$1 permanent;
}
include inc/favicon.conf;
include inc/robots.disallow.conf;
add_header 'X-XSS-Protection' '1; mode=block';
add_header 'X-Frame-Options' 'SAMEORIGIN';
add_header 'X-Content-Type-Options' 'nosniff';
add_header 'X-DNS-Prefetch-Control' 'on';
expires -1;
root $WWWROOT_DIR/apijs.org;
# 上报日志
access_log syslog:server=kibana-fluentd:8989,tag=apijs_org Fluentd;
error_log syslog:server=kibana-fluentd:8988,tag=apijs_org error;
}
# https://*.apijs.org -> 403
server {
server_name *.apijs.org;
include inc/ssl.conf;
ssl_certificate ca/apijs.org/fullchain.cer;
ssl_certificate_key ca/apijs.org/apijs.org.key;
include inc/favicon.conf;
include inc/robots.disallow.conf;
# 上报日志
access_log syslog:server=kibana-fluentd:8989,tag=apijs_org_default Fluentd;
error_log syslog:server=kibana-fluentd:8988,tag=apijs_org_default error;
location / {
return 403;
}
}
# https://*.apijs.net -> https://*.apijs.org
server {
server_name ~^(?<sub>[\w-]+)\.apijs.net$;
include inc/ssl.conf;
ssl_certificate ca/apijs.org/fullchain.cer;
ssl_certificate_key ca/apijs.org/apijs.org.key;
location / {
rewrite ^/(.*)$ https://$sub.apijs.org/$1 permanent;
}
}
# http://apijs.* -> https://apijs.*;
server {
listen 80;
server_name apijs.org *.apijs.org apijs.net *.apijs.net;
location / {
add_header strict-transport-security 'max-age=31536000; includeSubDomains; preload';
rewrite ^/(.*)$ https://$host/$1 permanent;
}
}