1
0
mirror of https://github.com/ellmau/nixos.git synced 2025-12-19 09:29:36 +01:00
nixos/modules/server/nginx.nix
Stefan Ellmauthaler e8033618bd
Add www.ellmauthaler.net redirect to website
Signed-off-by: Stefan Ellmauthaler <stefan.ellmauthaler@gmail.com>
2024-09-20 12:09:58 +02:00

42 lines
902 B
Nix

{
config,
lib,
pkgs,
...
}:
with lib; {
config = let
cfg = config.elss.server.nginx;
in
mkIf cfg.enable {
services.nginx = {
enable = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
};
networking.firewall.allowedTCPPorts = [80 443];
services.nginx.virtualHosts = {
"localhost" = {
addSSL = false;
enableACME = false;
root = "/var/www/localhost";
default = true;
};
"ellmauthaler.net" = {
addSSL = true;
enableACME = true;
root = "/var/www/localhost";
};
"www.ellmauthaler.net" = {
enableACME = true;
forceSSL = true;
globalRedirect = "stefan.ellmauthaler.net";
};
};
};
}