1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-29 19:17:45 +00:00

Configure new site

This commit is contained in:
RGBCube 2024-02-24 11:36:04 +03:00
parent 12da49d348
commit 39c92a88c4
No known key found for this signature in database
5 changed files with 25 additions and 141 deletions

View file

@ -3,6 +3,8 @@
let
inherit (config.networking) domain;
sitePath = "/var/www/site";
chatDomain = "chat.${domain}";
syncDomain = "sync.${domain}";
@ -95,11 +97,11 @@ in serverSystemConfiguration {
locations."/_matrix".proxyPass = "http://[::]:${toString synapsePort}";
locations."/_synapse/client".proxyPass = "http://[::]:${toString synapsePort}";
locations."/".proxyPass = "http://[::]:${toString config.services.site.port}/404/";
locations."/assets" = {
proxyPass = "http://[::]:${toString config.services.site.port}/assets";
locations."/".alias = "${sitePath}/404.html";
locations."/assets/"= {
alias = "${sitePath}/assets/";
extraConfig = ''
add_header Cache-Control "public, max-age=10800, immutable";
add_header Cache-Control "public, max-age=86400, immutable";
'';
};
};
@ -120,11 +122,11 @@ in serverSystemConfiguration {
locations."~ ^(\\/_matrix|\\/_synapse\\/client)"
.proxyPass = "http://[::]:${toString syncPort}";
locations."/".proxyPass = "http://[::]:${toString config.services.site.port}/404/";
locations."/assets" = {
proxyPass = "http://[::]:${toString config.services.site.port}/assets";
locations."/".alias = "${sitePath}/404.html";
locations."/assets/" = {
alias = "${sitePath}/assets/";
extraConfig = ''
add_header Cache-Control "public, max-age=10800, immutable";
add_header Cache-Control "public, max-age=86400, immutable";
'';
};
};

View file

@ -3,21 +3,23 @@
let
inherit (config.networking) domain;
port = 8003;
in serverSystemConfiguration {
services.site = enabled {
inherit port;
};
path = "/var/www/site";
services.nginx.virtualHosts.${domain} = (sslTemplate domain) // {
locations."/".proxyPass = "http://[::]:${toString port}";
locations."/assets" = {
proxyPass = "http://[::]:${toString port}/assets";
assetsLocation = {
locations."/assets/" = {
alias = "${path}/assets/";
extraConfig = ''
add_header Cache-Control "public, max-age=10800, immutable";
add_header Cache-Control "public, max-age=86400, immutable";
'';
};
};
in serverSystemConfiguration {
services.nginx.virtualHosts.${domain} = (sslTemplate domain) // assetsLocation // {
locations."/" = {
alias = "${path}/";
tryFiles = "$uri $uri/ $uri.html $uri/index.html =404";
};
};
services.nginx.virtualHosts."www.${domain}" = (sslTemplate domain) // {
locations."/".extraConfig = ''
@ -25,13 +27,7 @@ in serverSystemConfiguration {
'';
};
services.nginx.virtualHosts._ = (sslTemplate domain) // {
locations."/".proxyPass = "http://[::]:${toString port}/404/";
locations."/assets" = {
proxyPass = "http://[::]:${toString port}/assets";
extraConfig = ''
add_header Cache-Control "public, max-age=10800, immutable";
'';
};
services.nginx.virtualHosts._ = (sslTemplate domain) // assetsLocation // {
locations."/".alias = "${path}/404.html";
};
}