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,6 +4,10 @@ let
|
|||
inherit (config.networking) domain;
|
||||
|
||||
port = 8003;
|
||||
|
||||
cacheConfig = ''
|
||||
add_header Cache-Control "public, max-age=10800, immutable";
|
||||
'';
|
||||
in serverSystemConfiguration {
|
||||
services.site = enabled {
|
||||
inherit port;
|
||||
|
@ -11,6 +15,10 @@ in serverSystemConfiguration {
|
|||
|
||||
services.nginx.virtualHosts.${domain} = (sslTemplate domain) // {
|
||||
locations."/".proxyPass = "http://[::]:${toString port}";
|
||||
locations."/assets" = {
|
||||
proxyPass = "http://[::]:${toString port}/assets";
|
||||
extraConfig = cacheConfig;
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."www.${domain}" = (sslTemplate domain) // {
|
||||
|
@ -21,6 +29,9 @@ in serverSystemConfiguration {
|
|||
|
||||
services.nginx.virtualHosts._ = (sslTemplate domain) // {
|
||||
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