hosts/suwako: move filehost from marisa to suwako

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2025-09-04 15:32:26 +05:30
parent 6d431bdf9d
commit c2a1654be8
5 changed files with 50 additions and 28 deletions

View File

@@ -3,7 +3,6 @@
imports = [
# ./hashicorp.nix
./filehost.nix
./gitea.nix
];

View File

@@ -13,8 +13,7 @@
22
443
80
8080
25565
25565 # minecraft
];
};
};

View File

@@ -3,6 +3,7 @@
imports = [
./nginx.nix
./pufferpanel.nix
./filehost.nix
];
virtualisation.docker = {

View File

@@ -5,32 +5,55 @@ in
{
services.nginx = {
enable = true;
virtualHosts = with conf.network.addresses.wireguard.ips; {
"moj.${domain}" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "https://${suwako}:25565";
appendHttpConfig = ''
map $uri $expires {
default off;
~\.(jpg|jpeg|png|gif|ico)$ 30d;
}
'';
virtualHosts =
let
genericHttpRProxy =
{
addr,
ssl ? true,
conf ? "",
}:
{
enableACME = ssl;
# addSSL = ssl;
forceSSL = ssl;
locations."/" = {
proxyPass = toString addr;
extraConfig = ''
expires $expires;
proxy_set_header Host $host;
''
+ conf;
};
};
in
with conf.network.addresses.wireguard.ips;
{
"moj.${domain}" = genericHttpRProxy { addr = "https://${suwako}:25565"; };
"puffer.${domain}" = genericHttpRProxy {
addr = "http://${suwako}:8080";
conf = ''
proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Connection "Upgrade";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Nginx-Proxy true;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 100M;
'';
};
# Personal filehost
"f.${domain}" = genericHttpRProxy { addr = "http://${suwako}:8000"; };
};
"puffer.${domain}" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://${suwako}:8080";
};
extraConfig = ''
proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Connection "Upgrade";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Nginx-Proxy true;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 100M;
'';
};
};
};
}