1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-30 03:27:45 +00:00

plausible: add to other services

This commit is contained in:
RGBCube 2025-06-08 05:49:18 +03:00
parent e7cf9c7239
commit f8c824dd0a
Signed by: RGBCube
SSH key fingerprint: SHA256:CzqbPcfwt+GxFYNnFVCqoN5Itn4YFrshg1TrnACpA5M
6 changed files with 31 additions and 10 deletions

View file

@ -52,6 +52,7 @@ in {
https "max-age=31536000; includeSubdomains; preload";
}
# FIXME: These two aren't working.
map $http_origin $allow_origin {
~^https://.+\.${domain}$ $http_origin;
}

View file

@ -2,6 +2,7 @@
inherit (config.networking) domain;
inherit (lib) enabled merge;
fqdn = domain;
root = "/var/www/site";
in {
imports = [(self + /modules/nginx.nix)];
@ -16,7 +17,7 @@ in {
}
'';
virtualHosts.${domain} = merge config.services.nginx.sslTemplate {
virtualHosts.${fqdn} = merge config.services.nginx.sslTemplate {
inherit root;
locations."/".tryFiles = "$uri $uri.html $uri/index.html =404";
@ -29,6 +30,8 @@ in {
extraConfig = /* nginx */ ''
error_page 404 /404.html;
${config.services.plausible.extraNginxConfigFor fqdn}
'';
locations."/404".extraConfig = /* nginx */ ''
@ -36,12 +39,12 @@ in {
'';
};
virtualHosts."www.${domain}" = merge config.services.nginx.sslTemplate {
locations."/".return = "301 https://${domain}$request_uri";
virtualHosts."www.${fqdn}" = merge config.services.nginx.sslTemplate {
locations."/".return = "301 https://${fqdn}$request_uri";
};
virtualHosts._ = merge config.services.nginx.sslTemplate {
locations."/".return = "301 https://${domain}/404";
locations."/".return = "301 https://${fqdn}/404";
};
};
}