2022-10-12 19:58:09 +01:00
|
|
|
{config, ...}: let
|
|
|
|
domain = config.services.nginx.domain;
|
|
|
|
in {
|
|
|
|
services.tlaternet-webserver = {
|
|
|
|
enable = true;
|
|
|
|
listen = {
|
|
|
|
addr = "127.0.0.1";
|
|
|
|
port = 8000;
|
2021-12-26 19:00:59 +00:00
|
|
|
};
|
2021-04-19 00:39:33 +01:00
|
|
|
};
|
|
|
|
|
2022-10-12 19:58:09 +01:00
|
|
|
# Set up SSL
|
|
|
|
services.nginx.virtualHosts."${domain}" = let
|
|
|
|
inherit (config.services.tlaternet-webserver.listen) addr port;
|
|
|
|
in {
|
|
|
|
serverAliases = ["www.${domain}"];
|
2021-04-12 01:44:10 +01:00
|
|
|
|
2022-10-12 19:58:09 +01:00
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
extraConfig = ''
|
|
|
|
add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;
|
2023-10-02 21:53:56 +01:00
|
|
|
access_log /var/log/nginx/${domain}/access.log upstream_time;
|
2022-10-12 19:58:09 +01:00
|
|
|
'';
|
2021-04-12 01:44:10 +01:00
|
|
|
|
2022-10-12 19:58:09 +01:00
|
|
|
locations."/".proxyPass = "http://${addr}:${toString port}";
|
2021-04-12 01:44:10 +01:00
|
|
|
};
|
|
|
|
}
|