nginx again :)

This commit is contained in:
Your Name 2024-02-29 03:43:19 +03:00
parent f455d919bd
commit 1a8a8a08be

View file

@ -62,30 +62,36 @@
]; ];
}; };
systemd.services.grafanasocat43 = { services.nginx.enable = true;
enable = true; services.nginx.virtualHosts."grafana_first" = {
description = "grafana vpn"; forceSSL = false;
wantedBy = [ "multi-user.target" ]; listen = [{port = 2000; addr="0.0.0.0"; ssl=false;}];
serviceConfig = { locations."/".extraConfig = ''
Restart = "on-failure"; proxy_set_header Host $host;
RestartSec = "15"; proxy_set_header X-Real-IP $remote_addr;
Type="simple"; proxy_pass http://123.123.123.123:3000;
ExecStart="${pkgs.socat}/bin/socat tcp-l:2000,fork,reuseaddr tcp:123.123.123.123:3000"; '';
DynamicUser=true; locations."/api/live/ws".extraConfig = ''
}; proxy_pass http://123.123.123.123:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
'';
}; };
services.nginx.virtualHosts."grafana_second" = {
systemd.services.grafanasocat44 = { forceSSL = false;
enable = true; listen = [{port = 2001; addr="0.0.0.0"; ssl=false;}];
description = "grafana vpn"; locations."/".extraConfig = ''
wantedBy = [ "multi-user.target" ]; proxy_set_header Host $host;
serviceConfig = { proxy_set_header X-Real-IP $remote_addr;
Restart = "on-failure"; proxy_pass http://123.123.123.123:3000;
RestartSec = "15"; '';
Type="simple"; locations."/api/live/ws".extraConfig = ''
ExecStart="${pkgs.socat}/bin/socat tcp-l:2001,fork,reuseaddr tcp:123.123.123.123:3000"; proxy_pass http://123.123.123.123:3000;
DynamicUser=true; proxy_http_version 1.1;
}; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
'';
}; };
system.stateVersion = "22.11"; system.stateVersion = "22.11";