copyparty

This commit is contained in:
Lennart J. Kurzweg (Nx2)
2025-08-24 14:50:35 +02:00
parent 7978dc1987
commit 871a270a21
5 changed files with 120 additions and 31 deletions

View File

@@ -19,7 +19,7 @@
};
};
users.users."nginx" = {
extraGroups = [ "nginx" "acme" ];
extraGroups = [ "nginx" "acme" "copyparty" ];
useDefaultShell = false;
linger = true;
home = "/var/nginx/";
@@ -65,6 +65,14 @@
statusPage = false;
streamConfig = ""; # udp config
validateConfigFile = true;
upstreams = {
"partysock" = {
servers."unix:/dev/shm/party.sock".fail_timeout = "1s";
extraConfig = /* nginx */ ''
keepalive 1;
'';
};
};
virtualHosts = let
vh = {
kTLS = true;
@@ -186,10 +194,41 @@
# proxyWebsockets = true;
# }; };
# };
"file.${hyper.domain}" = { # copyparty
listen = dl;
forceSSL = true;
enableACME = true;
locations = {
"/" = {
proxyPass = "http://partysock";
proxyWebsockets = true;
extraConfig = /* nginx */ ''
proxy_redirect off;
# disable buffering (next 4 lines)
# proxy_http_version 1.1; # this is set by nixos
client_max_body_size 0;
proxy_buffering off;
proxy_request_buffering off;
# improve download speed from 600 to 1500 MiB/s
proxy_buffers 32 8k;
proxy_buffer_size 16k;
proxy_busy_buffers_size 24k;
proxy_set_header Connection "Keep-Alive";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# NOTE: with cloudflare you want this X-Forwarded-For instead:
#proxy_set_header X-Forwarded-For $http_cf_connecting_ip;
'';
};
};
};
"~^(.*).${hyper.domain}$" = {
listen = dl;
root = "/var/nginx/webroot";
locations = { "~.*" = { return = "301 https://${hyper.domain}/502.html"; }; };
locations."~.*".return = "502";
};
};
};