fix: nginx mastodon WEB_DOMAIN LOCAL_DOMAIN #26

Merged
b12f merged 7 commits from mastodon-fix-web-domain into main 2023-10-28 21:04:45 +00:00
3 changed files with 31 additions and 1 deletions
Showing only changes of commit 1983edcc5b - Show all commits

View file

@ -36,7 +36,6 @@
enable = true;
# Different from WEB_DOMAIN in our case
localDomain = "pub.solar";
configureNginx = true;
enableUnixSocket = true;
# Processes used by the mastodon-streaming service. Defaults to the number
# of CPU cores minus one

View file

@ -0,0 +1,30 @@
{ config, lib, ... }:
let
cfg = config.services.mastodon;
in
{
services.nginx.virtualHosts = {
"mastodon.pub.solar" = {
root = "${cfg.package}/public/";
# mastodon only supports https, but you can override this if you offload tls elsewhere.
forceSSL = lib.mkDefault true;
enableACME = lib.mkDefault true;
locations."/system/".alias = "/var/lib/mastodon/public-system/";
locations."/" = {
tryFiles = "$uri @proxy";
};
locations."@proxy" = {
proxyPass = (if cfg.enableUnixSocket then "http://unix:/run/mastodon-web/web.socket" else "http://127.0.0.1:${toString(cfg.webPort)}");
proxyWebsockets = true;
};
locations."/api/v1/streaming/" = {
proxyPass = (if cfg.enableUnixSocket then "http://unix:/run/mastodon-streaming/streaming.socket" else "http://127.0.0.1:${toString(cfg.streamingPort)}/");
proxyWebsockets = true;
};
};
};
}

View file

@ -10,6 +10,7 @@
./nix.nix
./apps/nginx.nix
./apps/nginx-mastodon.nix
./apps/nginx-mastodon-files.nix
./apps/nginx-website.nix
./apps/mastodon.nix