forked from lukas/nixos-config
39 lines
1.1 KiB
Nix
39 lines
1.1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
{
|
|
systemd.services.website-production = {
|
|
description = "Production website for lukasrosier.com";
|
|
wantedBy = [ "multi-user.target" ];
|
|
before = [ "traefik.service" ];
|
|
serviceConfig = {
|
|
User = "drone";
|
|
Group = "users";
|
|
ExecStart = "${pkgs.static-web-server}/bin/static-web-server --host 127.0.0.1 --port 8003 --root /var/www/website";
|
|
Restart = "always";
|
|
RestartSec = "5s";
|
|
};
|
|
};
|
|
|
|
services.traefik.dynamicConfigOptions.http = {
|
|
middlewares.website2-canonical.redirectRegex = {
|
|
regex = "^https://www\\.${lib.escapeRegex config.domain2}/(.*)";
|
|
replacement = "https://${config.domain2}/\${1}";
|
|
permanent = true;
|
|
};
|
|
|
|
services.website2.loadBalancer.servers = [
|
|
{
|
|
url = "http://127.0.0.1:8003/";
|
|
}
|
|
];
|
|
|
|
routers.website2 = {
|
|
rule = "Host(`${config.domain2}`) || Host(`www.${config.domain2}`)";
|
|
middlewares = [ "website2-canonical" ];
|
|
tls = {
|
|
certResolver = "cloudflare";
|
|
};
|
|
service = "website2";
|
|
entrypoints = "websecure";
|
|
};
|
|
};
|
|
}
|