1
0
Fork 0

sail: Partially move Mastodon off of CF

This commit is contained in:
Daniel Kempkens 2023-03-06 17:11:13 +01:00
parent a50276f120
commit c088193e28
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM

View file

@ -2,16 +2,6 @@
let let
web-domain = "mastodon.kempkens.io"; web-domain = "mastodon.kempkens.io";
nginx-extra-proxy-settings = ''
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_force_ranges on;
'';
in in
{ {
services.mastodon = { services.mastodon = {
@ -81,22 +71,12 @@ in
}; };
services.nginx = { services.nginx = {
enable = true;
recommendedOptimisation = true;
recommendedGzipSettings = true;
recommendedBrotliSettings = true;
virtualHosts."${web-domain}" = { virtualHosts."${web-domain}" = {
listen = [ http3 = true;
{
addr = "127.0.0.1";
port = 80;
}
];
root = "${config.services.mastodon.package}/public/"; root = "${config.services.mastodon.package}/public/";
forceSSL = false; forceSSL = true;
enableACME = false; useACMEHost = "kempkens.io";
locations."/system/" = { locations."/system/" = {
extraConfig = '' extraConfig = ''
@ -109,15 +89,21 @@ in
}; };
locations."@proxy" = { locations."@proxy" = {
recommendedProxySettings = true;
proxyPass = "http://unix:/run/mastodon-web/web.socket"; proxyPass = "http://unix:/run/mastodon-web/web.socket";
proxyWebsockets = true; proxyWebsockets = true;
extraConfig = nginx-extra-proxy-settings; extraConfig = ''
proxy_force_ranges on;
'';
}; };
locations."/api/v1/streaming/" = { locations."/api/v1/streaming/" = {
recommendedProxySettings = true;
proxyPass = "http://unix:/run/mastodon-streaming/streaming.socket"; proxyPass = "http://unix:/run/mastodon-streaming/streaming.socket";
proxyWebsockets = true; proxyWebsockets = true;
extraConfig = nginx-extra-proxy-settings; extraConfig = ''
proxy_force_ranges on;
'';
}; };
}; };
}; };