From c40cbf74f38ffec18a0541f3fc2368cf95a841b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Tue, 14 May 2024 16:56:09 -0300 Subject: [PATCH] nginx: add .xyz -> .com redirect --- hosts/phantom/nginx.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hosts/phantom/nginx.nix b/hosts/phantom/nginx.nix index 08ece70..f0aea0e 100644 --- a/hosts/phantom/nginx.nix +++ b/hosts/phantom/nginx.nix @@ -1,10 +1,23 @@ -{ config, pkgs, inputs, ... }: { +{ config, pkgs, lib, ... }: { services.nginx = { enable = true; recommendedProxySettings = true; recommendedTlsSettings = true; + recommendedOptimisation = true; + recommendedGzipSettings = true; }; + # Redirect *lelgenio.xyz -> *lelgenio.com + services.nginx.virtualHosts = lib.mapAttrs' + (key: value: lib.nameValuePair "${key}lelgenio.xyz" value) + ( + lib.genAttrs [ "" "social." "blog." "cloud." "mail." ] (name: { + enableACME = true; + forceSSL = true; + locations."/".return = "301 $scheme://${name}lelgenio.com$request_uri"; + }) + ); + security.acme = { acceptTerms = true; defaults.email = "lelgenio@disroot.org";