-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
88 lines (76 loc) · 2.01 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
##
# Drop invalid requests
##
server {
listen 80 default_server;
return 444;
}
##
# Canonical Domain: sober.page
# Note: Only external redirects should be handled by this server block.
##
map $host $canonical_redirect {
# Generated by ./sync:make_map()
default https://about.sober.page/unconfigured/;
include canonical_redirects.map;
}
server {
# Socket Settings
listen 80;
# Common Headers
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header Vary "Accept-Encoding";
# Forward to external domain
server_name *.sober.page;
return 302 $canonical_redirect;
# Increase cache lifetime
add_header Cloudflare-CDN-Cache-Control max-age=43200;
add_header Cache-Control "public";
add_header Pragma public;
expires 1d;
}
##
# Backup/Alias: sobersupport.group
# Note: Nearly all requests to this domain will use this server block.
##
map $http_cf_visitor $cf_scheme {
default $scheme;
'~"scheme":"https"' "https";
'~"scheme":"http"' "http";
}
server {
# Socket Settings
listen 80;
# Common Headers
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header Vary "Accept-Encoding";
# Forward <fwd>.sobersupport.group/<path> to <fwd>.sober.page/<path>
server_name ~^(?<fwd>.+)\.sobersupport\.group$;
return 301 $cf_scheme://$fwd.sober.page$request_uri;
# Increase cache lifetime
add_header Cloudflare-CDN-Cache-Control max-age=86400;
add_header Cache-Control "public";
add_header Pragma public;
expires max;
}
##
# Redirect to main "about" page
##
server {
# Socket Settings
listen 80;
# Common Headers
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header Vary "Accept-Encoding";
# Forward apex and www to about page
server_name sober.page www.sober.page sobersupport.group www.sobersupport.group;
return 301 https://about.sober.page$request_uri;
# Increase cache lifetime
add_header Cloudflare-CDN-Cache-Control max-age=86400;
add_header Cache-Control "public";
add_header Pragma public;
expires max;
}