feat : Add modular service to hostname
This commit is contained in:
parent
9453773af6
commit
1637885001
11 changed files with 112 additions and 66 deletions
|
|
@ -1,17 +1,16 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
lib.mkIf (config.networking.hostName == "ThinkCentre-Server-004") {
|
||||
with lib;
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts = {
|
||||
{
|
||||
services.nginx.enable = true;
|
||||
|
||||
services.nginx.virtualHosts = mkMerge [
|
||||
(mkIf config.sVAULTWARDEN.enable {
|
||||
"${config.HostName}-vault" = {
|
||||
listen = [
|
||||
{ addr = "0.0.0.0"; port = 8000; }
|
||||
];
|
||||
|
||||
listen = [{ addr = "0.0.0.0"; port = config.sVAULTWARDEN.externalPort; }];
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:8222";
|
||||
proxyPass = "http://127.0.0.1:${toString config.sVAULTWARDEN.internalPort}";
|
||||
extraConfig = ''
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
|
@ -20,21 +19,18 @@ lib.mkIf (config.networking.hostName == "ThinkCentre-Server-004") {
|
|||
'';
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf config.sROUNDCUBE.enable {
|
||||
"${config.HostName}-roundcube" = {
|
||||
listen = [
|
||||
{ addr = "0.0.0.0"; port = 1984; }
|
||||
];
|
||||
|
||||
listen = [{ addr = "0.0.0.0"; port = config.sROUNDCUBE.port; }];
|
||||
root = "${pkgs.roundcube}/public_html";
|
||||
|
||||
locations."/" = {
|
||||
extraConfig = ''
|
||||
index index.php index.html;
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
'';
|
||||
};
|
||||
|
||||
locations."~ \\.php$" = {
|
||||
extraConfig = ''
|
||||
include ${pkgs.nginx}/conf/fastcgi_params;
|
||||
|
|
@ -43,9 +39,11 @@ lib.mkIf (config.networking.hostName == "ThinkCentre-Server-004") {
|
|||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 1984 8000 ];
|
||||
networking.firewall.allowedTCPPorts = concatLists [
|
||||
(if config.sVAULTWARDEN.enable then [ config.sVAULTWARDEN.externalPort ] else [])
|
||||
(if config.sROUNDCUBE.enable then [ config.sROUNDCUBE.port ] else [])
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue