forked from pub-solar/infra
fix: add nginx virtualHost for mastodon
We use pub.solar as our LOCAL_DOMAIN and mastodon.pub.solar as our WEB_DOMAIN. The NixOS module does not support this special use case. See: https://github.com/NixOS/nixpkgs/issues/202399
This commit is contained in:
parent
b718a29d3a
commit
1983edcc5b
|
@ -36,7 +36,6 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
# Different from WEB_DOMAIN in our case
|
# Different from WEB_DOMAIN in our case
|
||||||
localDomain = "pub.solar";
|
localDomain = "pub.solar";
|
||||||
configureNginx = true;
|
|
||||||
enableUnixSocket = true;
|
enableUnixSocket = true;
|
||||||
# Processes used by the mastodon-streaming service. Defaults to the number
|
# Processes used by the mastodon-streaming service. Defaults to the number
|
||||||
# of CPU cores minus one
|
# of CPU cores minus one
|
||||||
|
|
30
hosts/nachtigall/apps/nginx-mastodon.nix
Normal file
30
hosts/nachtigall/apps/nginx-mastodon.nix
Normal 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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -10,6 +10,7 @@
|
||||||
./nix.nix
|
./nix.nix
|
||||||
./apps/nginx.nix
|
./apps/nginx.nix
|
||||||
|
|
||||||
|
./apps/nginx-mastodon.nix
|
||||||
./apps/nginx-mastodon-files.nix
|
./apps/nginx-mastodon-files.nix
|
||||||
./apps/nginx-website.nix
|
./apps/nginx-website.nix
|
||||||
./apps/mastodon.nix
|
./apps/mastodon.nix
|
||||||
|
|
Loading…
Reference in a new issue