egirls-nixos/heartles-xyz-proxy.nix

55 lines
1.2 KiB
Nix
Raw Normal View History

2024-02-29 21:08:22 +00:00
{ config, lib, ... }: {
networking.firewall.allowedTCPPorts = [ 80 443 ];
security.acme = {
acceptTerms = true;
defaults.email = "admin+acme@heartles.xyz";
certs."STAR.home.heartles.xyz" = {
domain = "*.home.heartles.xyz";
dnsProvider = "namecheap";
credentialsFile = "/etc/nixos-secrets/namecheap-acme";
group = "nginx";
};
};
services.nginx = {
enable = true;
recommendedProxySettings = true;
virtualHosts = {
"*.home.heartles.xyz" = {
listen = [
{
port = 443;
addr = "0.0.0.0";
ssl = true;
}
{
port = 80;
addr = "0.0.0.0";
}
{
port = 443;
addr = "[::]";
ssl = true;
}
{
port = 80;
addr = "[::]";
}
];
useACMEHost = "STAR.home.heartles.xyz";
forceSSL = true;
locations."/" = {
proxyWebsockets = true;
extraConfig = ''
proxy_ssl_name $host;
include /etc/nixos-secrets/nginx-proxy-pass-home.conf;
'';
};
};
};
};
}