aboutsummaryrefslogtreecommitdiff
path: root/roles/cosmos
diff options
context:
space:
mode:
Diffstat (limited to 'roles/cosmos')
-rw-r--r--roles/cosmos/tasks/main.yml22
-rw-r--r--roles/cosmos/templates/nginx.conf.j271
2 files changed, 93 insertions, 0 deletions
diff --git a/roles/cosmos/tasks/main.yml b/roles/cosmos/tasks/main.yml
new file mode 100644
index 0000000..c44505e
--- /dev/null
+++ b/roles/cosmos/tasks/main.yml
@@ -0,0 +1,22 @@
1---
2- block:
3 - name: Ensure cosmos web root exists
4 ansible.builtin.file:
5 path: /srv/http/cosmos.party
6 state: directory
7 owner: cmmm
8 group: www-data
9 mode: '0775'
10
11 - name: Deploy cosmos nginx site configuration
12 ansible.builtin.template:
13 src: nginx.conf.j2
14 dest: /etc/nginx/http.d/cosmos.conf
15 owner: root
16 group: root
17 mode: '0444'
18 validate: nginx-validate %s /etc/nginx/http.d/cosmos.conf
19 notify: Reload nginx
20
21 tags:
22 - cosmos
diff --git a/roles/cosmos/templates/nginx.conf.j2 b/roles/cosmos/templates/nginx.conf.j2
new file mode 100644
index 0000000..b9b6c67
--- /dev/null
+++ b/roles/cosmos/templates/nginx.conf.j2
@@ -0,0 +1,71 @@
1# -*- Nginx -*-
2# {{ ansible_managed }}
3
4server {
5 listen 80;
6 listen [::]:80;
7 server_name cosmos.party
8 www.cosmos.party
9 git.cosmos.party
10 lists.cosmos.party
11 andr.cosmos.party;
12
13 location ^~ /.well-known/acme-challenge/ {
14 root /var/www/acme;
15 }
16
17 location / {
18 return 307 https://$host$request_uri;
19 }
20}
21
22server {
23 server_name cosmos.party
24 www.cosmos.party;
25
26 listen unix:/var/run/nginx/http.sock;
27 listen 443 ssl;
28 listen [::]:443 ssl;
29 listen 443 quic;
30 listen [::]:443 quic;
31
32 http2 on;
33 http3 on;
34
35 add_header Alt-Svc 'h3=":443"; ma=86400';
36
37 ssl_certificate /etc/ssl/cosmos.party.fullchain.pem;
38 ssl_certificate_key /etc/ssl/private/cosmos.party.key;
39 ssl_protocols TLSv1.2 TLSv1.3;
40
41 root /srv/http/cosmos.party;
42 index index.html;
43
44 location /en/ { try_files $uri $uri/ =404; }
45 location /ru/ { try_files $uri $uri/ =404; }
46 location /sk/ { try_files $uri $uri/ =404; }
47 location / { try_files $uri /en$uri /en$uri/ =404; }
48}
49
50server {
51 server_name andr.cosmos.party;
52
53
54 listen unix:/var/run/nginx/http.sock;
55 listen 443 ssl;
56 listen [::]:443 ssl;
57 listen 443 quic;
58 listen [::]:443 quic;
59
60 http2 on;
61 http3 on;
62
63 ssl_certificate /etc/ssl/cosmos.party.fullchain.pem;
64 ssl_certificate_key /etc/ssl/private/cosmos.party.key;
65 ssl_protocols TLSv1.2 TLSv1.3;
66
67 add_header Alt-Svc 'h3=":443"; ma=86400';
68
69 root /srv/http/$host;
70 autoindex on;
71}