aboutsummaryrefslogtreecommitdiff
path: root/modules/caddy.nix
blob: c2c41e4a0e8ba3824691948720d80e04cc35b12d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{ ... }:

# Caddy reverse proxy with automatic HTTPS (Let's Encrypt).
# All app ports are bound to 127.0.0.1; only Caddy listens on 80/443.
{
  services.caddy = {
    enable = true;
    email = "me@karanj.com";

    virtualHosts = {

      # AdGuard Home web UI
      "dns.karanj.com" = {
        extraConfig = ''
          reverse_proxy 127.0.0.1:3000
        '';
      };

      # Miniflux RSS reader
      "rss.karanj.com" = {
        extraConfig = ''
          reverse_proxy 127.0.0.1:8080
        '';
      };

      # Actual Budget
      "budget.karanj.com" = {
        extraConfig = ''
          reverse_proxy 127.0.0.1:5006
        '';
      };

      # cgit - public read-only git viewer + smart HTTP for git clone/pull
      "git.karanj.com" = {
        extraConfig = ''
          # Smart HTTP git (clone/pull only - no push exposed)
          handle /git/* {
            reverse_proxy 127.0.0.1:8085
          }
          # cgit web UI
          handle {
            reverse_proxy 127.0.0.1:8086
          }
        '';
      };

    };
  };
}