1
0
Fork 0

mastodon: configure nginx

This commit is contained in:
Daniel Kempkens 2022-11-29 15:51:54 +01:00
parent b6538568b1
commit a8af700e66
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM

View file

@ -1,5 +1,8 @@
{ secret, ... }: { config, secret, ... }:
let
web-domain = "mastodon.kempkens.io";
in
{ {
services.mastodon = { services.mastodon = {
enable = true; enable = true;
@ -11,7 +14,7 @@
streamingPort = 55000; streamingPort = 55000;
webPort = 55001; webPort = 55001;
sidekiqPort = 55002; sidekiqPort = 55002;
enableUnixSocket = false; enableUnixSocket = true;
trustedProxy = "172.18.0.4"; trustedProxy = "172.18.0.4";
@ -56,7 +59,33 @@
}; };
extraConfig = { extraConfig = {
WEB_DOMAIN = "mastodon.kempkens.io"; WEB_DOMAIN = web-domain;
};
};
services.nginx = {
enable = true;
recommendedProxySettings = true;
virtualHosts."${web-domain}" = {
root = "${config.services.mastodon.package}/public/";
forceSSL = false;
enableACME = false;
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://unix:/run/mastodon-streaming/streaming.socket";
proxyWebsockets = true;
};
}; };
}; };