nixos-config/hosts/phantom/nginx.nix

29 lines
755 B
Nix
Raw Normal View History

2024-05-14 16:56:09 -03:00
{ 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;
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)
(
2024-05-15 15:52:48 -03:00
lib.genAttrs [ "" "social." "blog." "cloud." "mail." "git." ] (name: {
2024-05-14 16:56:09 -03:00
enableACME = true;
forceSSL = true;
locations."/".return = "301 $scheme://${name}lelgenio.com$request_uri";
})
);
2024-03-28 21:56:52 -03:00
security.acme = {
acceptTerms = true;
defaults.email = "lelgenio@disroot.org";
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
}