vpn2: split nginx config
This commit is contained in:
parent
24b0fcf632
commit
040bb41705
3 changed files with 50 additions and 49 deletions
43
nixosConfigurations/hetzner-vpn2/blog.nix
Normal file
43
nixosConfigurations/hetzner-vpn2/blog.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
blog-domain-socket = "/run/nginx/blog.sock";
|
||||
anubis-domain-socket = "/run/anubis/anubis-main/anubis.sock";
|
||||
anubis-metrics-socket = "/run/anubis/anubis-main/anubis-metrics.sock";
|
||||
in
|
||||
{
|
||||
systemd.services = {
|
||||
nginx.serviceConfig.SupplementaryGroups = [ "anubis" ];
|
||||
anubis-main.serviceConfig.SupplementaryGroups = [ "nginx" ];
|
||||
};
|
||||
|
||||
services = {
|
||||
nginx.virtualHosts = {
|
||||
"zerforschen.plus" = {
|
||||
addSSL = true;
|
||||
enableACME = true;
|
||||
locations = {
|
||||
"/_metrics".proxyPass = "http://unix:" + anubis-metrics-socket + ":/metrics";
|
||||
"/".proxyPass = "http://unix:" + anubis-domain-socket;
|
||||
};
|
||||
};
|
||||
|
||||
"blog-in-anubis" = {
|
||||
root = pkgs.zerforschen-plus-content;
|
||||
listen = [
|
||||
{
|
||||
addr = "unix:" + blog-domain-socket;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
anubis.instances.main = {
|
||||
enable = true;
|
||||
settings = {
|
||||
BIND = anubis-domain-socket;
|
||||
TARGET = "unix://" + blog-domain-socket;
|
||||
METRICS_BIND = anubis-metrics-socket;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
./hardware.nix
|
||||
./nginx.nix
|
||||
./headscale.nix
|
||||
./blog.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
|
|
|
|||
|
|
@ -1,62 +1,19 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
blog-domain-socket = "/run/nginx/blog.sock";
|
||||
anubis-domain-socket = "/run/anubis/anubis-main/anubis.sock";
|
||||
anubis-metrics-socket = "/run/anubis/anubis-main/anubis-metrics.sock";
|
||||
in
|
||||
{
|
||||
security.acme = {
|
||||
acceptTerms = true;
|
||||
defaults.email = "acme@zerforschen.plus";
|
||||
};
|
||||
|
||||
systemd.services = {
|
||||
nginx.serviceConfig.SupplementaryGroups = [ "anubis" ];
|
||||
anubis-main.serviceConfig.SupplementaryGroups = [ "nginx" ];
|
||||
};
|
||||
|
||||
services = {
|
||||
nginx = {
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
recommendedProxySettings = true;
|
||||
recommendedTlsSettings = true;
|
||||
recommendedGzipSettings = true;
|
||||
recommendedOptimisation = true;
|
||||
|
||||
virtualHosts = {
|
||||
"zerforschen.plus" = {
|
||||
addSSL = true;
|
||||
enableACME = true;
|
||||
locations = {
|
||||
"/_metrics".proxyPass = "http://unix:" + anubis-metrics-socket + ":/metrics";
|
||||
"/".proxyPass = "http://unix:" + anubis-domain-socket;
|
||||
};
|
||||
};
|
||||
|
||||
"blog-in-anubis" = {
|
||||
root = pkgs.zerforschen-plus-content;
|
||||
listen = [
|
||||
{
|
||||
addr = "unix:" + blog-domain-socket;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
anubis.instances.main = {
|
||||
enable = true;
|
||||
settings = {
|
||||
BIND = anubis-domain-socket;
|
||||
TARGET = "unix://" + blog-domain-socket;
|
||||
METRICS_BIND = anubis-metrics-socket;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
80
|
||||
443
|
||||
5201
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue