fix(wordpress): Use different local IP addresses

This commit is contained in:
Tom Hubrecht 2024-01-08 17:39:45 +01:00
parent 7249301a33
commit f9a8d428b1

View file

@ -1,4 +1,4 @@
{ config, lib, ... }:
{ config, lib, pkgs, ... }:
let
inherit (lib) mkEnableOption mkIf mkOption;
@ -10,17 +10,12 @@ let
mkName = builtins.replaceStrings [ "." ] [ "-" ];
mkConfig = { name, value }: {
mkConfig = { name, value, i }: {
services.wordpress = {
webserver = "nginx";
sites.${name} = value;
};
security.acme = {
acceptTerms = true;
defaults.email = "acme@dgnum.eu";
};
services.nginx.virtualHosts.${name} = {
onlySSL = true;
sslCertificate = "${certs.${name}.directory}/fullchain.pem";
@ -28,9 +23,14 @@ let
sslTrustedCertificate = "${certs.${name}.directory}/chain.pem";
};
networking.hostName = mkName name;
networking = {
hostName = mkName name;
hosts."10.0.0.${builtins.toString i}" = [ name ];
networking.firewall.allowedTCPPorts = [ 443 ];
firewall.allowedTCPPorts = [ 443 ];
};
environment.systemPackages = [ pkgs.wp-cli ];
system.stateVersion = "23.11";
};
@ -52,11 +52,11 @@ let
};
hostAddress = "10.31.41.${builtins.toString i}";
localAddress = "10.0.0.1";
localAddress = "10.0.0.${builtins.toString i}";
autoStart = true;
config = mkConfig site;
config = mkConfig (site // { inherit i; });
};
};