2024-10-06 23:09:22 +02:00
|
|
|
{ config, pkgs, ... }:
|
2024-02-02 19:54:06 +01:00
|
|
|
let
|
|
|
|
domain = "ese.${config.networking.domain}";
|
2024-10-06 20:37:13 +02:00
|
|
|
webRoot = "/srv/web/ese";
|
2024-02-02 19:54:06 +01:00
|
|
|
in
|
|
|
|
{
|
|
|
|
services.nginx = {
|
|
|
|
virtualHosts."${domain}" = {
|
|
|
|
locations."= /" = {
|
2024-10-06 16:54:32 +02:00
|
|
|
# temporary redirect, to avoid caching problems
|
|
|
|
return = "302 /2024/";
|
2024-02-02 19:54:06 +01:00
|
|
|
};
|
|
|
|
locations."/" = {
|
2024-10-06 20:37:13 +02:00
|
|
|
root = webRoot;
|
2024-02-02 19:54:06 +01:00
|
|
|
tryFiles = "$uri $uri/ =404";
|
|
|
|
};
|
2024-10-06 16:54:32 +02:00
|
|
|
# cache static assets
|
|
|
|
locations."~* \.(?:css|svg|webp|jpg|jpeg|gif|png|ico|mp4|mp3|ogg|ogv|webm|ttf|woff2|woff)$" = {
|
2024-10-06 20:37:13 +02:00
|
|
|
root = webRoot;
|
2024-10-06 16:54:32 +02:00
|
|
|
extraConfig = ''
|
|
|
|
expires 1y;
|
|
|
|
'';
|
|
|
|
};
|
2024-02-02 19:54:06 +01:00
|
|
|
};
|
|
|
|
};
|
2024-10-06 23:09:22 +02:00
|
|
|
|
|
|
|
users.users."ese-deploy" = {
|
|
|
|
isNormalUser = true;
|
|
|
|
openssh.authorizedKeys.keys = [
|
|
|
|
''command="${pkgs.rrsync}/bin/rrsync ${webRoot}",restrict ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEWGdTdobZN2oSLsTQmHOahdc9vqyuwUBS0PSk5IQhGV''
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-02-02 19:54:06 +01:00
|
|
|
}
|