2023-12-25 00:06:26 +01:00
|
|
|
{ config, values, ... }:
|
2024-06-10 10:45:59 +02:00
|
|
|
let
|
|
|
|
gitea = config.services.gitea.settings;
|
|
|
|
keycloak = config.services.keycloak.settings;
|
|
|
|
in {
|
2023-12-25 00:06:26 +01:00
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
enableReload = true;
|
|
|
|
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
recommendedTlsSettings = true;
|
|
|
|
recommendedGzipSettings = true;
|
|
|
|
recommendedOptimisation = true;
|
|
|
|
|
|
|
|
defaultListen = [
|
|
|
|
{
|
|
|
|
addr = "192.168.10.175";
|
2023-12-25 01:37:05 +01:00
|
|
|
port = 80;
|
2023-12-25 00:06:26 +01:00
|
|
|
ssl = false;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
networking.firewall.allowedTCPPorts = [
|
|
|
|
80 443 # Internal / Default
|
|
|
|
43080 43443 # External / Publicly exposed
|
|
|
|
];
|
|
|
|
|
|
|
|
security.acme = {
|
|
|
|
acceptTerms = true;
|
|
|
|
defaults.email = "felix@albrigtsen.it";
|
|
|
|
};
|
2023-12-25 01:37:05 +01:00
|
|
|
|
|
|
|
# Publicly exposed services:
|
|
|
|
|
|
|
|
services.nginx.virtualHosts = let
|
2024-06-06 20:47:15 +02:00
|
|
|
publicProxy = upstream: overrides: {
|
2023-12-25 01:37:05 +01:00
|
|
|
listen = [
|
|
|
|
{ addr = "192.168.10.175"; port = 43443; ssl = true; }
|
|
|
|
{ addr = "192.168.10.175"; port = 43080; ssl = false; }
|
|
|
|
];
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
|
|
|
|
locations."/".proxyPass = "${upstream}";
|
2024-01-03 02:35:57 +01:00
|
|
|
|
|
|
|
extraConfig = ''
|
2024-01-03 03:05:47 +01:00
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
2024-01-28 01:10:59 +01:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_set_header Host $host;
|
2024-01-03 02:35:57 +01:00
|
|
|
|
2024-01-28 01:10:59 +01:00
|
|
|
server_tokens off;
|
2024-01-03 02:35:57 +01:00
|
|
|
'';
|
2024-06-06 20:47:15 +02:00
|
|
|
} // overrides;
|
2024-01-28 01:10:59 +01:00
|
|
|
in {
|
2024-09-25 19:28:45 +02:00
|
|
|
# "cloud.feal.no" = publicProxy "" {
|
|
|
|
# locations."/" = {
|
|
|
|
# proxyPass = "http://challenger.home.feal.no";
|
|
|
|
# extraConfig = ''
|
|
|
|
# client_max_body_size 8G;
|
|
|
|
# '';
|
|
|
|
# };
|
|
|
|
# };
|
|
|
|
"git.feal.no" = publicProxy "http://unix:${gitea.server.HTTP_ADDR}" {
|
|
|
|
default = true;
|
2024-06-12 14:48:06 +02:00
|
|
|
};
|
2024-09-25 19:28:45 +02:00
|
|
|
"jf.feal.no" = publicProxy "http://jellyfin.home.feal.no/" { };
|
|
|
|
"iam.feal.no" = publicProxy "http://${keycloak.http-host}:${toString keycloak.http-port}" { };
|
|
|
|
"music.feal.no" = publicProxy "http://challenger.home.feal.no/" { };
|
2023-12-25 01:37:05 +01:00
|
|
|
};
|
2023-12-25 00:06:26 +01:00
|
|
|
}
|