From 62428777b7862720c1441e126a26f53c6076ba94 Mon Sep 17 00:00:00 2001 From: Martin Michalec Date: Thu, 22 Oct 2026 23:20:17 +0300 Subject: feat: add cosmos site --- roles/cosmos/tasks/main.yml | 22 +++++++++++ roles/cosmos/templates/nginx.conf.j2 | 71 ++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 roles/cosmos/tasks/main.yml create mode 100644 roles/cosmos/templates/nginx.conf.j2 (limited to 'roles/cosmos') 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 @@ +--- +- block: + - name: Ensure cosmos web root exists + ansible.builtin.file: + path: /srv/http/cosmos.party + state: directory + owner: cmmm + group: www-data + mode: '0775' + + - name: Deploy cosmos nginx site configuration + ansible.builtin.template: + src: nginx.conf.j2 + dest: /etc/nginx/http.d/cosmos.conf + owner: root + group: root + mode: '0444' + validate: nginx-validate %s /etc/nginx/http.d/cosmos.conf + notify: Reload nginx + + tags: + - 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 @@ +# -*- Nginx -*- +# {{ ansible_managed }} + +server { + listen 80; + listen [::]:80; + server_name cosmos.party + www.cosmos.party + git.cosmos.party + lists.cosmos.party + andr.cosmos.party; + + location ^~ /.well-known/acme-challenge/ { + root /var/www/acme; + } + + location / { + return 307 https://$host$request_uri; + } +} + +server { + server_name cosmos.party + www.cosmos.party; + + listen unix:/var/run/nginx/http.sock; + listen 443 ssl; + listen [::]:443 ssl; + listen 443 quic; + listen [::]:443 quic; + + http2 on; + http3 on; + + add_header Alt-Svc 'h3=":443"; ma=86400'; + + ssl_certificate /etc/ssl/cosmos.party.fullchain.pem; + ssl_certificate_key /etc/ssl/private/cosmos.party.key; + ssl_protocols TLSv1.2 TLSv1.3; + + root /srv/http/cosmos.party; + index index.html; + + location /en/ { try_files $uri $uri/ =404; } + location /ru/ { try_files $uri $uri/ =404; } + location /sk/ { try_files $uri $uri/ =404; } + location / { try_files $uri /en$uri /en$uri/ =404; } +} + +server { + server_name andr.cosmos.party; + + + listen unix:/var/run/nginx/http.sock; + listen 443 ssl; + listen [::]:443 ssl; + listen 443 quic; + listen [::]:443 quic; + + http2 on; + http3 on; + + ssl_certificate /etc/ssl/cosmos.party.fullchain.pem; + ssl_certificate_key /etc/ssl/private/cosmos.party.key; + ssl_protocols TLSv1.2 TLSv1.3; + + add_header Alt-Svc 'h3=":443"; ma=86400'; + + root /srv/http/$host; + autoindex on; +} -- cgit v1.3.1