blob: 32d80e7eb4a41c8cffc58e50cebf4524bf77e408 (
plain)
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
|
<% our @prefixes = ('', 'www.', 'standby.'); -%>
# Plain HTTP for ACME and HTTPS redirect
<% for my $host (@$acme_hosts) { for my $prefix (@prefixes) { -%>
server "<%= $prefix.$host %>" {
listen on * port 80
log style forwarded
location "/.well-known/acme-challenge/*" {
root "/acme"
request strip 2
}
location * {
block return 302 "https://$HTTP_HOST$REQUEST_URI"
}
}
<% } } -%>
# Current server's FQDN (e.g. for mail server ACME cert requests)
server "<%= "$hostname.$domain" %>" {
listen on * port 80
log style forwarded
location "/.well-known/acme-challenge/*" {
root "/acme"
request strip 2
}
location * {
block return 302 "https://<%= "$hostname.$domain" %>"
}
}
server "<%= "$hostname.$domain" %>" {
listen on * port 8080
log style forwarded
location * {
root "/htdocs/buetow.org/self"
directory auto index
}
}
# Gemtexter hosts
<% for my $host (qw/foo.zone stats.foo.zone/) { for my $prefix (@prefixes) { -%>
server "<%= $prefix.$host %>" {
listen on * port 8080
log style forwarded
location "/.git*" {
block return 302 "https://<%= $prefix.$host %>"
}
location * {
<% if ($prefix eq 'www.') { -%>
block return 302 "https://<%= $host %>$REQUEST_URI"
<% } else { -%>
root "/htdocs/gemtexter/<%= $host %>"
directory auto index
<% } -%>
}
}
<% } } -%>
# Redirect to paul.buetow.org
<% for my $prefix (@prefixes) { -%>
server "<%= $prefix %>buetow.org" {
listen on * port 8080
log style forwarded
location * {
block return 302 "https://paul.buetow.org$REQUEST_URI"
}
}
# Redirect blog to foo.zone
server "<%= $prefix %>blog.buetow.org" {
listen on * port 8080
log style forwarded
location * {
block return 302 "https://foo.zone$REQUEST_URI"
}
}
server "<%= $prefix %>snonux.foo" {
listen on * port 8080
log style forwarded
location * {
block return 302 "https://foo.zone/about$REQUEST_URI"
}
}
server "<%= $prefix %>paul.buetow.org" {
listen on * port 8080
log style forwarded
location * {
block return 302 "https://foo.zone/about$REQUEST_URI"
}
}
<% } -%>
# Redirect to gitub.dtail.dev
<% for my $prefix (@prefixes) { -%>
server "<%= $prefix %>dtail.dev" {
listen on * port 8080
log style forwarded
location * {
block return 302 "https://github.dtail.dev$REQUEST_URI"
}
}
<% } -%>
# Irregular Ninja special hosts
<% for my $prefix (@prefixes) { -%>
server "<%= $prefix %>irregular.ninja" {
listen on * port 8080
log style forwarded
location * {
root "/htdocs/irregular.ninja"
directory auto index
}
}
<% } -%>
<% for my $prefix (@prefixes) { -%>
server "<%= $prefix %>alt.irregular.ninja" {
listen on * port 8080
log style forwarded
location * {
root "/htdocs/alt.irregular.ninja"
directory auto index
}
}
<% } -%>
# joern special host
<% for my $prefix (@prefixes) { -%>
server "<%= $prefix %>joern.buetow.org" {
listen on * port 8080
log style forwarded
location * {
root "/htdocs/joern/"
directory auto index
}
}
<% } -%>
# Dory special host
<% for my $prefix (@prefixes) { -%>
server "<%= $prefix %>dory.buetow.org" {
listen on * port 8080
log style forwarded
location * {
root "/htdocs/joern/dory.buetow.org"
directory auto index
}
}
<% } -%>
# ecat special host
<% for my $prefix (@prefixes) { -%>
server "<%= $prefix %>ecat.buetow.org" {
listen on * port 8080
log style forwarded
location * {
root "/htdocs/joern/ecat.buetow.org"
directory auto index
}
}
<% } -%>
# Fallback for f3s hosts - serve fallback page for ALL paths
<% for my $host (@$f3s_hosts) { for my $prefix (@prefixes) { -%>
server "<%= $prefix.$host %>" {
listen on * port 8080
log style forwarded
location * {
# Rewrite all requests to /index.html to show fallback page regardless of path
request rewrite "/index.html"
root "/htdocs/f3s_fallback"
}
}
<% } } -%>
# Defaults
server "default" {
listen on * port 80
log style forwarded
block return 302 "https://foo.zone$REQUEST_URI"
}
server "default" {
listen on * port 8080
log style forwarded
block return 302 "https://foo.zone$REQUEST_URI"
}
|