mirror of
https://github.com/RGBCube/ncc
synced 2025-07-30 11:37:44 +00:00
Cache assets
This commit is contained in:
parent
1c7731a909
commit
9386715e92
1 changed files with 14 additions and 3 deletions
|
@ -4,13 +4,21 @@ let
|
||||||
inherit (config.networking) domain;
|
inherit (config.networking) domain;
|
||||||
|
|
||||||
port = 8003;
|
port = 8003;
|
||||||
|
|
||||||
|
cacheConfig = ''
|
||||||
|
add_header Cache-Control "public, max-age=10800, immutable";
|
||||||
|
'';
|
||||||
in serverSystemConfiguration {
|
in serverSystemConfiguration {
|
||||||
services.site = enabled {
|
services.site = enabled {
|
||||||
inherit port;
|
inherit port;
|
||||||
};
|
};
|
||||||
|
|
||||||
services.nginx.virtualHosts.${domain} = (sslTemplate domain) // {
|
services.nginx.virtualHosts.${domain} = (sslTemplate domain) // {
|
||||||
locations."/".proxyPass = "http://[::]:${toString port}";
|
locations."/".proxyPass = "http://[::]:${toString port}";
|
||||||
|
locations."/assets" = {
|
||||||
|
proxyPass = "http://[::]:${toString port}/assets";
|
||||||
|
extraConfig = cacheConfig;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.nginx.virtualHosts."www.${domain}" = (sslTemplate domain) // {
|
services.nginx.virtualHosts."www.${domain}" = (sslTemplate domain) // {
|
||||||
|
@ -20,7 +28,10 @@ in serverSystemConfiguration {
|
||||||
};
|
};
|
||||||
|
|
||||||
services.nginx.virtualHosts._ = (sslTemplate domain) // {
|
services.nginx.virtualHosts._ = (sslTemplate domain) // {
|
||||||
locations."/".proxyPass = "http://[::]:${toString port}/404/";
|
locations."/".proxyPass = "http://[::]:${toString port}/404/";
|
||||||
locations."/assets".proxyPass = "http://[::]:${toString port}/assets";
|
locations."/assets" = {
|
||||||
|
proxyPass = "http://[::]:${toString port}/assets";
|
||||||
|
extraConfig = cacheConfig;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue