fruitbasket/modules/web/ese.nix

27 lines
607 B
Nix
Raw Normal View History

2024-09-26 20:11:04 +02:00
{ config, ... }:
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
};
};
}