Infini-OPTIPLEX: refactor nginx config and use acme certs

This commit is contained in:
Infinidoge 2024-04-26 02:43:52 -04:00
parent 12bb7ac8db
commit d784d4eee4
Signed by: Infinidoge
SSH key fingerprint: SHA256:VEv3zmkBzcYYle6/37h+BbOyNDbGy/o8SHh7fcs9RbQ
8 changed files with 83 additions and 31 deletions

View file

@ -8,6 +8,7 @@
./thelounge.nix
./vaultwarden.nix
./jellyfin.nix
./web.nix
];
system.stateVersion = "23.05";
@ -59,30 +60,17 @@
services.fail2ban.enable = true;
services.nginx = {
enable = true;
services.nginx.enable = true;
virtualHosts =
let
cfg = config.services.nginx;
inherit (config.common.nginx) ssl ssl-optional;
in
{
"*.inx.moe" = ssl // {
globalRedirect = "inx.moe";
};
"blahaj.inx.moe" = ssl-optional // {
locations."/" = {
tryFiles = "/Blahaj.png =404";
root = ./static;
};
};
"nitter.inx.moe" = ssl // {
globalRedirect = "twitter.com";
};
"ponder.inx.moe" = ssl // {
locations."/".root = pkgs.ponder;
};
};
security.acme.certs."inx.moe" = {
group = "nginx";
extraDomainNames = [ "*.inx.moe" ];
};
services.nginx.virtualHosts."*.inx.moe" = {
useACMEHost = "inx.moe";
addSSL = true;
default = true;
globalRedirect = "inx.moe";
};
}