nixos

NixOS server files. Mirror from https://git.nordgedanken.dev/kubernetes/nixos
git clone git://archive.git.mtrnord.blog/MTRNord/nixos.git
Log | Files | Refs | README

commit 6a52af58a0e82e1cb1e16b868059655f92942ad0
parent 8ca2fe9ab0a76d4a753688d84e8ae0ca867438a6
Author: MTRNord <mtrnord1@gmail.com>
Date:   Mon, 11 Dec 2023 12:28:04 +0100

Setup nginx

Diffstat:
Mnixos/worker-2/configuration.nix | 32++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+), 0 deletions(-)

diff --git a/nixos/worker-2/configuration.nix b/nixos/worker-2/configuration.nix @@ -400,6 +400,18 @@ in { services = { nginx = { enable = true; + recommendedProxySettings = true; + upstreams.mastodon-streaming = { + extraConfig = '' + least_conn; + ''; + servers = + builtins.listToAttrs + (map (i: { + name = "unix:/run/mastodon-streaming/streaming-${toString i}.socket"; + value = {}; + }) (lib.range 1 services.mastodon.streamingProcesses)); + }; virtualHosts = { "search.midnightthoughts.space" = { forceSSL = true; @@ -412,6 +424,26 @@ in { ''; }; }; + "mastodon.nordgedanken.dev" = { + root = "${services.mastodon.package}/public/"; + forceSSL = true; + enableACME = true; + locations."/system/".alias = "/var/lib/mastodon/public-system/"; + + locations."/" = { + tryFiles = "$uri @proxy"; + }; + + locations."@proxy" = { + proxyPass = "http://unix:/run/mastodon-web/web.socket"; + proxyWebsockets = true; + }; + + locations."/api/v1/streaming/" = { + proxyPass = "http://mastodon-streaming"; + proxyWebsockets = true; + }; + }; }; };