fix: nginx config for pub.solar website

This commit is contained in:
teutat3s 2023-10-28 17:50:37 +02:00
parent a35969e8e4
commit 5ffc4f67ff
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1
3 changed files with 19 additions and 9 deletions

View file

@ -1,12 +1,25 @@
{ ... }:
{
systemd.tmpfiles.rules = [
"d '/srv/www/pub.solar' 0750 hakkonaut hakkonaut - -"
];
services.nginx.virtualHosts = {
"www.pub.solar".locations."/".extraConfig = "return 301 https://pub.solar$request_uri";
"www.pub.solar" = {
enableACME = true;
addSSL = true;
locations."/" = {
extraConfig = ''
return 301 https://pub.solar$request_uri;
'';
};
};
"pub.solar" = {
default = true;
enableACME = true;
forceSSL = true;
locations = {
# serve base domain pub.solar for mastodon.pub.solar
@ -21,7 +34,7 @@
"/.well-known/webfinger" = {
# Redirect requests that match /.well-known/webfinger?resource=* to Mastodon
extraConfig = ''
if ($arg_resource) = {
if ($arg_resource) {
return 301 https://mastodon.pub.solar$request_uri;
}
@ -32,14 +45,14 @@
"/satzung" = {
extraConfig = ''
return 302 /satzung https://cloud.pub.solar/s/2tRCP9aZFCiWxQy;
return 302 https://cloud.pub.solar/s/2tRCP9aZFCiWxQy;
'';
};
"/" = {
root = "/srv/www/pub.solar";
index = "index.html";
tryFiles = "$uri $uri/";
tryFiles = "$uri $uri/ =404";
};
};
};

View file

@ -20,8 +20,4 @@ in {
};
networking.firewall.allowedTCPPorts = [80 443];
systemd.tmpfiles.rules = [
"d '/srv/www/pub.solar' 0750 hakkonaut hakkonaut - -"
];
}

View file

@ -41,7 +41,8 @@
users.users.hakkonaut = {
description = "CI and automation user";
home = "/var/nix/iso-cache";
home = "/home/hakkonaut";
createHome = true;
useDefaultShell = true;
uid = 998;
group = "hakkonaut";