hosts/suwako: move filehost from marisa to suwako
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
imports = [
|
||||
./nginx.nix
|
||||
./pufferpanel.nix
|
||||
./filehost.nix
|
||||
];
|
||||
|
||||
virtualisation.docker = {
|
||||
|
25
hosts/suwako/services/filehost.nix
Normal file
25
hosts/suwako/services/filehost.nix
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
inputs,
|
||||
conf,
|
||||
...
|
||||
}:
|
||||
{
|
||||
systemd.services.filehost = {
|
||||
enable = true;
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
Environment = [
|
||||
"TITLE=nattofiles"
|
||||
"USER_URL=https://f.${conf.network.addresses.domain.natto}"
|
||||
"ROCKET_LIMITS={file=\"512MB\",data-form=\"512MB\"}"
|
||||
"ROCKET_LOG_LEVEL=debug"
|
||||
"ROCKET_ADDRESS=0.0.0.0"
|
||||
];
|
||||
Restart = "on-failure";
|
||||
ExecStart = "${inputs.filehost.packages.${pkgs.system}.simpler-filehost}/bin/simpler-filehost";
|
||||
};
|
||||
};
|
||||
}
|
@@ -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;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user