feat(web-servers): add SSL support

This commit is contained in:
Mohammad Rafiq 2025-06-04 20:49:54 +08:00
parent 5ba9667f4e
commit 5dfec647b0
No known key found for this signature in database

View file

@ -9,16 +9,41 @@ in
};
};
config = lib.mkMerge [
{
security.acme = {
acceptTerms = true;
defaults.email = "rafiq@rrv.sh";
};
}
(lib.mkIf cfg.nginx.enable {
networking.firewall.allowedTCPPorts = [ 80 ];
networking.firewall.allowedTCPPorts = [
443
80
];
services.nginx = {
enable = true;
virtualHosts.${config.system.hostname} = {
locations."/" = {
return = "200 '<html><body>It works!</body></html'";
extraConfig = ''
default_type text/html;
'';
virtualHosts = {
"chat.bwfiq.com" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://helios:3080";
};
};
"il.bwfiq.com" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://helios:2283";
};
};
${config.system.hostname} = {
locations."/" = {
return = "200 '<html><body>It works!</body></html'";
extraConfig = ''
default_type text/html;
'';
};
};
};
};