Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/ops/nginx/tala.conf
blob: a8164ff21439d450f75f9caefb7cb911e7f6c408 (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
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
# SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com>
# SPDX-License-Identifier: AGPL-3.0-or-later WITH AdditionRef-Progmasoft-Patent-Grant-1.1

# One frontend build serves four sites: tala.run for the language,
# talac.tala.run for the compiler, talafmt.tala.run for the formatter and
# talalint.tala.run for the linter. The page picks its content from the host
# name. xsharp-lang.xyz, the former domain, answers with a permanent redirect to
# the same path on tala.run. tazel.tala.run, where the build system was
# documented, answers with a permanent redirect to tazel.net, its own site.
# The policies allow Cloudflare Web Analytics, which Cloudflare adds to each page.

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name tala-unmatched.invalid;
    server_tokens off;

    return 444;
}

server {
    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;
    server_name _;
    server_tokens off;

    ssl_reject_handshake on;
}

server {
    listen 80;
    listen [::]:80;
    server_name tala.run www.tala.run talac.tala.run tazel.tala.run talafmt.tala.run talalint.tala.run;
    server_tokens off;

    location ^~ /.well-known/acme-challenge/ {
        root /var/lib/letsencrypt;
        default_type text/plain;
    }

    location / {
        return 308 https://$host$request_uri;
    }
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    server_name tala.run;

    root /srv/xsharp/website/current/frontend;
    index index.html;
    server_tokens off;

    ssl_certificate /etc/letsencrypt/live/tala.run/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/tala.run/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    add_header Content-Security-Policy "default-src 'self'; script-src 'self' https://static.cloudflareinsights.com; connect-src 'self' https://cloudflareinsights.com; img-src 'self' data:; base-uri 'self'; form-action 'self'; frame-ancestors 'none'; object-src 'none'" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;
    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-Frame-Options "DENY" always;

    # Keep retired registry paths closed on the language host. Accounts and
    # packages belong to separate Progmasoft services, not this Vue artifact.
    location = /repo {
        return 404;
    }

    location ^~ /repo/ {
        return 404;
    }

    # Only the language site's own public metadata crosses into the API.
    # A catch-all /api proxy would accidentally expose legacy registry routes.
    location = /api/v1/site {
        proxy_pass http://127.0.0.1:5086/api/v1/site;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_connect_timeout 2s;
        proxy_read_timeout 5s;
    }

    location ^~ /api/ {
        return 404;
    }

    # The robots and sitemap files of the two documentation hosts.
    location ^~ /hosts/ {
        return 404;
    }

    location / {
        # Vue Router uses history URLs; real files still win before the app shell.
        try_files $uri $uri/ @application;
    }

    # The application has two kinds of routes: the landing page and
    # /docs/<page>. Any other path that is not a file is answered with 404, so
    # that unknown addresses, including the probes for /wp-login.php and
    # friends, are not served as pages. The body of the 404 is still the
    # application, whose router takes a visitor to the landing page.
    location @application {
        if ($uri !~ "^/(docs/[a-z0-9-]+/?)?$") {
            return 404;
        }
        rewrite ^ /index.html break;
    }

    error_page 404 /index.html;

    location ~ /\. {
        deny all;
    }
}

# talac.tala.run, talafmt.tala.run and talalint.tala.run serve
# the same build; each answers for robots.txt and sitemap.xml with its own file.
server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    server_name talac.tala.run;

    root /srv/xsharp/website/current/frontend;
    index index.html;
    server_tokens off;

    ssl_certificate /etc/letsencrypt/live/tala.run/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/tala.run/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    add_header Content-Security-Policy "default-src 'self'; script-src 'self' https://static.cloudflareinsights.com; connect-src 'self' https://cloudflareinsights.com; img-src 'self' data:; base-uri 'self'; form-action 'self'; frame-ancestors 'none'; object-src 'none'" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;
    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-Frame-Options "DENY" always;

    location = /robots.txt {
        try_files /hosts/talac/robots.txt =404;
    }

    location = /sitemap.xml {
        try_files /hosts/talac/sitemap.xml =404;
    }

    location ^~ /hosts/ {
        return 404;
    }

    location ^~ /api/ {
        return 404;
    }

    location / {
        try_files $uri $uri/ @application;
    }

    # The application has two kinds of routes: the landing page and
    # /docs/<page>. Any other path that is not a file is answered with 404, so
    # that unknown addresses, including the probes for /wp-login.php and
    # friends, are not served as pages. The body of the 404 is still the
    # application, whose router takes a visitor to the landing page.
    location @application {
        if ($uri !~ "^/(docs/[a-z0-9-]+/?)?$") {
            return 404;
        }
        rewrite ^ /index.html break;
    }

    error_page 404 /index.html;

    location ~ /\. {
        deny all;
    }
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    server_name talafmt.tala.run;

    root /srv/xsharp/website/current/frontend;
    index index.html;
    server_tokens off;

    ssl_certificate /etc/letsencrypt/live/tala.run/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/tala.run/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    add_header Content-Security-Policy "default-src 'self'; script-src 'self' https://static.cloudflareinsights.com; connect-src 'self' https://cloudflareinsights.com; img-src 'self' data:; base-uri 'self'; form-action 'self'; frame-ancestors 'none'; object-src 'none'" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;
    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-Frame-Options "DENY" always;

    location = /robots.txt {
        try_files /hosts/talafmt/robots.txt =404;
    }

    location = /sitemap.xml {
        try_files /hosts/talafmt/sitemap.xml =404;
    }

    location ^~ /hosts/ {
        return 404;
    }

    location ^~ /api/ {
        return 404;
    }

    location / {
        try_files $uri $uri/ @application;
    }

    # The application has two kinds of routes: the landing page and
    # /docs/<page>. Any other path that is not a file is answered with 404, so
    # that unknown addresses, including the probes for /wp-login.php and
    # friends, are not served as pages. The body of the 404 is still the
    # application, whose router takes a visitor to the landing page.
    location @application {
        if ($uri !~ "^/(docs/[a-z0-9-]+/?)?$") {
            return 404;
        }
        rewrite ^ /index.html break;
    }

    error_page 404 /index.html;

    location ~ /\. {
        deny all;
    }
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    server_name talalint.tala.run;

    root /srv/xsharp/website/current/frontend;
    index index.html;
    server_tokens off;

    ssl_certificate /etc/letsencrypt/live/tala.run/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/tala.run/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    add_header Content-Security-Policy "default-src 'self'; script-src 'self' https://static.cloudflareinsights.com; connect-src 'self' https://cloudflareinsights.com; img-src 'self' data:; base-uri 'self'; form-action 'self'; frame-ancestors 'none'; object-src 'none'" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;
    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-Frame-Options "DENY" always;

    location = /robots.txt {
        try_files /hosts/talalint/robots.txt =404;
    }

    location = /sitemap.xml {
        try_files /hosts/talalint/sitemap.xml =404;
    }

    location ^~ /hosts/ {
        return 404;
    }

    location ^~ /api/ {
        return 404;
    }

    location / {
        try_files $uri $uri/ @application;
    }

    # The application has two kinds of routes: the landing page and
    # /docs/<page>. Any other path that is not a file is answered with 404, so
    # that unknown addresses, including the probes for /wp-login.php and
    # friends, are not served as pages. The body of the 404 is still the
    # application, whose router takes a visitor to the landing page.
    location @application {
        if ($uri !~ "^/(docs/[a-z0-9-]+/?)?$") {
            return 404;
        }
        rewrite ^ /index.html break;
    }

    error_page 404 /index.html;

    location ~ /\. {
        deny all;
    }
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    server_name tazel.tala.run;
    server_tokens off;

    ssl_certificate /etc/letsencrypt/live/tala.run/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/tala.run/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;

    # The two pages of the old site have their own pages on tazel.net; any
    # other page of its docs goes to the docs, everything else to the same path.
    location ~ "^/docs/(commands|project-file)/?$" {
        return 308 https://tazel.net/docs/reference/$1$is_args$args;
    }

    location /docs/ {
        return 308 https://tazel.net/docs;
    }

    location / {
        return 308 https://tazel.net$request_uri;
    }
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    server_name www.tala.run;
    server_tokens off;

    ssl_certificate /etc/letsencrypt/live/tala.run/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/tala.run/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
    return 308 https://tala.run$request_uri;
}

# The former domain. Every path keeps working and lands on the same path of
# tala.run.
server {
    listen 80;
    listen [::]:80;
    server_name xsharp-lang.xyz www.xsharp-lang.xyz docs.xsharp-lang.xyz spec.xsharp-lang.xyz;
    server_tokens off;

    location ^~ /.well-known/acme-challenge/ {
        root /var/lib/letsencrypt;
        default_type text/plain;
    }

    location / {
        return 308 https://tala.run$request_uri;
    }
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    server_name xsharp-lang.xyz www.xsharp-lang.xyz docs.xsharp-lang.xyz spec.xsharp-lang.xyz;
    server_tokens off;

    ssl_certificate /etc/letsencrypt/live/xsharp-lang.xyz/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/xsharp-lang.xyz/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    return 308 https://tala.run$request_uri;
}

# The registry moved to Progmasoft before the rename; its former address keeps
# pointing there. tala.run has no ViGet host of its own.
server {
    listen 80;
    listen [::]:80;
    server_name viget.xsharp-lang.xyz;
    server_tokens off;

    location ^~ /.well-known/acme-challenge/ {
        root /var/lib/letsencrypt;
        default_type text/plain;
    }

    location / {
        return 308 https://viget.progmasoft.com$request_uri;
    }
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name viget.xsharp-lang.xyz;
    server_tokens off;

    ssl_certificate /etc/letsencrypt/live/xsharp-lang.xyz/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/xsharp-lang.xyz/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    return 308 https://viget.progmasoft.com$request_uri;
}