From 84682c67b65e51be9168bb87d30d31bbd6d614a5 Mon Sep 17 00:00:00 2001 From: Martin Michalec Date: Thu, 22 Oct 2026 23:28:49 +0300 Subject: feat: add cgit --- roles/cosmos/templates/nginx.conf.j2 | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'roles/cosmos/templates') diff --git a/roles/cosmos/templates/nginx.conf.j2 b/roles/cosmos/templates/nginx.conf.j2 index b9b6c67..98879ac 100644 --- a/roles/cosmos/templates/nginx.conf.j2 +++ b/roles/cosmos/templates/nginx.conf.j2 @@ -47,6 +47,51 @@ server { location / { try_files $uri /en$uri /en$uri/ =404; } } +server { + server_name git.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; + + location ~ /.+/(info/refs|git-upload-pack) { + include /etc/nginx/fastcgi_params; + fastcgi_param SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend; + fastcgi_param PATH_INFO $uri; + fastcgi_param GIT_PROJECT_ROOT /var/lib/git/repositories/; + fastcgi_pass unix:/var/run/cgit.sock-1; + } + + root /srv/http/git.cosmos.party/; + try_files $uri @cgit-static; + + location @cgit-static { + root /usr/share/webapps/cgit/; + try_files $uri @cgit; + } + + location @cgit { + include /etc/nginx/fastcgi_params; + fastcgi_param SCRIPT_FILENAME /usr/share/webapps/cgit/cgit.cgi; + fastcgi_param CGIT_CONFIG /etc/cgitrc-cosmos; + fastcgi_param PATH_INFO $uri; + fastcgi_param QUERY_STRING $args; + fastcgi_param HTTP_HOST $server_name; + fastcgi_pass unix:/var/run/cgit.sock-1; + } +} + server { server_name andr.cosmos.party; -- cgit v1.3.1