nixos-config/hosts/phantom/nginx.nix

48 lines
953 B
Nix
Raw Normal View History

{
config,
pkgs,
lib,
...
}:
{
2024-03-28 21:56:52 -03:00
services.nginx = {
enable = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
2024-05-14 16:56:09 -03:00
recommendedOptimisation = true;
recommendedGzipSettings = true;
clientMaxBodySize = "512M";
2024-03-28 21:56:52 -03:00
};
2024-05-14 16:56:09 -03:00
# Redirect *lelgenio.xyz -> *lelgenio.com
services.nginx.virtualHosts =
lib.mapAttrs' (key: value: lib.nameValuePair "${key}lelgenio.xyz" value)
(
lib.genAttrs
[
""
"social."
"blog."
"cloud."
"mail."
"git."
"syncthing."
]
(name: {
enableACME = true;
forceSSL = true;
locations."/".return = "301 $scheme://${name}lelgenio.com$request_uri";
})
);
2024-05-14 16:56:09 -03:00
2024-03-28 21:56:52 -03:00
security.acme = {
acceptTerms = true;
defaults.email = "lelgenio@disroot.org";
};
networking.firewall.allowedTCPPorts = [
80
443
];
2024-03-28 21:56:52 -03:00
}