Move Caddyfile to caddy.virtualHosts

This commit is contained in:
xqtc161 2024-06-19 11:09:38 +02:00
parent 6104163689
commit 7a8cb9b006
2 changed files with 91 additions and 41 deletions

View file

@ -26,44 +26,94 @@ with lib; {
services.caddy = { services.caddy = {
enable = true; enable = true;
email = "xqtc@tutanota.com"; email = "xqtc@tutanota.com";
configFile = pkgs.writeText "Caddyfile" '' # configFile = pkgs.writeText "Caddyfile" ''
heroin.trade { # heroin.trade {
root * /var/www/website/public/ # root * /var/www/website/public/
handle_errors { # handle_errors {
rewrite * /404.html # rewrite * /404.html
file_server # file_server
} # }
file_server # file_server
} # }
syncthing.heroin.trade { # syncthing.heroin.trade {
reverse_proxy http://localhost:8384 { # reverse_proxy http://localhost:8384 {
header_up Host {upstream_hostport} # header_up Host {upstream_hostport}
# }
# }
# demos.heroin.trade {
# root * /var/www/demos/
# file_server browse
# }
# git.heroin.trade {
# reverse_proxy http://localhost:3002
# }
#
# jellyfin.heroin.trade {
# reverse_proxy http://127.0.0.1:8096
# }
#
# calibre.heroin.trade {
# reverse_proxy http://localhost:3000
# }
#
# grafana.heroin.trade {
# reverse_proxy http://127.0.0.1:2342
# }
#
# uptime.heroin.trade {
# reverse_proxy 127.0.0.1:3001
# }
# '';
virtualHosts = {
"heroin.trade" = {
extraConfig = ''
root * /var/www/website/public/
handle_errors {
rewrite * /404.html
file_server
} }
} file_server
demos.heroin.trade { '';
root * /var/www/demos/ };
file_server browse "syncthing.heroin.trade" = {
} extraConfig = ''
git.heroin.trade { reverse_proxy http://localhost:8384 {
reverse_proxy http://localhost:3002 header_up Host {upstream_hostport}
} }
'';
jellyfin.heroin.trade { };
reverse_proxy http://127.0.0.1:8096 "demos.heroin.trade" = {
} extraConfig = ''
root * /var/www/demos/
calibre.heroin.trade { file_server browse
reverse_proxy http://localhost:3000 '';
} };
"git.heroin.trade" = {
grafana.heroin.trade { extraConfig = ''
reverse_proxy http://127.0.0.1:2342 reverse_proxy http://localhost:3002
} '';
};
uptime.heroin.trade { "jellyfin.heroin.trade" = {
reverse_proxy 127.0.0.1:3001 extraConfig = ''
} reverse_proxy http://127.0.0.1:8096
''; '';
};
"calibre.heroin.trade" = {
extraConfig = ''
reverse_proxy http://localhost:3000
'';
};
"grafana.heroin.trade" = {
extraConfig = ''
reverse_proxy http://127.0.0.1:2342
'';
};
"uptime.heroin.trade" = {
extraConfig = ''
reverse_proxy http://127.0.0.1:3001
'';
};
};
}; };
services.syncthing.settings.gui.insecureSkipHostcheck = true; services.syncthing.settings.gui.insecureSkipHostcheck = true;

View file

@ -21,7 +21,7 @@
port = 9002; port = 9002;
}; };
wireguard = { wireguard = {
enable = true; enable = true;
}; };
}; };
scrapeConfigs = [ scrapeConfigs = [
@ -30,9 +30,9 @@
static_configs = [ static_configs = [
{ {
targets = [ targets = [
"127.0.0.1:${toString config.services.prometheus.exporters.node.port}" "127.0.0.1:${toString config.services.prometheus.exporters.node.port}"
"127.0.0.1:${toString config.services.prometheus.exporters.wireguard.port}" "127.0.0.1:${toString config.services.prometheus.exporters.wireguard.port}"
]; ];
} }
]; ];
} }