Skip to content

Commit

Permalink
feat(cache): open firewall ports
Browse files Browse the repository at this point in the history
  • Loading branch information
klarkc committed Dec 20, 2023
1 parent 4bb0dd6 commit 36f2cc1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion setups/cache/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ let
agenix = flake.inputs.agenix.nixosModules.default;
domain = "cache.klarkc.is-a.dev";
home = "/home/klarkc";
port = 8080;
cache-module = { config, ... }: {
imports = [ logger atticd vm-nogui agenix host-keys ];
# cd secrets
Expand All @@ -33,13 +34,20 @@ let
};
};
};
networking.firewall.allowedTCPPorts = [
80
port
];
virtualisation.forwardPorts = [
{ from = "host"; host.port = port; guest.port = port; }
];
# Web server
services.nginx = {
virtualHosts.${domain} = {
forceSSL = true;
enableACME = true;
locations."/".extraConfig = ''
proxy_pass http://localhost:8080;
proxy_pass http://localhost:${port};
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down

0 comments on commit 36f2cc1

Please sign in to comment.