From 65174b4b5c05bb143e6681a4cbcd0a95f04987e2 Mon Sep 17 00:00:00 2001 From: Caroline Larimore Date: Thu, 18 Jul 2024 23:39:42 -0700 Subject: Begin modularization! --- roles/web/proxy/default.nix | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 roles/web/proxy/default.nix (limited to 'roles/web/proxy') diff --git a/roles/web/proxy/default.nix b/roles/web/proxy/default.nix new file mode 100644 index 0000000..879ef12 --- /dev/null +++ b/roles/web/proxy/default.nix @@ -0,0 +1,28 @@ +{ config, pkgs, lib, inputs, ... }: +with lib; + +let cfg = config.roles.web.proxy; in { + options.roles.web.proxy = { + enable = mkEnableOption "nginx reverse proxy"; + }; + + config = mkIf cfg.enable { + networking.firewall.allowedTCPPorts = [ 80 ]; + + services.nginx = { + enable = true; + virtualHosts = { + "localhost".locations = { + "/test" = { + recommendedProxySettings = true; + proxyPass = "http://192.168.0.2/"; + }; + "/stargazers" = { + recommendedProxySettings = true; + proxyPass = "http://192.168.0.3/"; + }; + }; + }; + }; + }; +} -- cgit v1.2.3