summaryrefslogtreecommitdiff
path: root/config/web-server.nix
blob: 72613a694a4d0f64ab218072fbbdd5f3c40f415f (plain)
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
50
51
52
53
54
55
{ config, lib, pkgs, ... }:
{
  networking.firewall.allowedTCPPorts = [ 80 443 ];
  services.nginx = {
    enable = true;
    recommendedProxySettings = true;
    appendHttpConfig = ''
      # This is a workaround to deal with closed connections on
      # large downloads.
      proxy_buffering off;
    '';
    virtualHosts = {
      "orbekk.com" = {
        enableACME = true;
        forceSSL = true;
        root = "/srv/www/orbekk";
      };
      "shape.orbekk.com" = {
        enableACME = true;
        forceSSL = true;
        root = "/srv/www/orbekk";
      };
      "kj.orbekk.com" = {
        enableACME = true;
        forceSSL = true;
        locations."/".proxyPass = "http://10.0.20.11:8011";
        locations."/hledger" = {
          extraConfig = ''return 302 /hledger/;'';
        };
        # locations."/hledger/" = {
        #   proxyPass = "http://localhost:5000/";
        #   extraConfig = ''
        #     auth_basic "hledger";
        #     auth_basic_user_file /opt/site/hledger-htpasswd;
        #   '';
        # };
        locations."/_matrix" = {
          proxyPass = "http://10.0.20.15:11102";
        };
      };
      "git.orbekk.com" = {
        enableACME = true;
        forceSSL = true;
        locations."/".proxyPass = "http://10.0.20.15:11103";
      };
      "hydra.orbekk.com" = {
        enableACME = true;
        forceSSL = true;
        locations."/" = {
          proxyPass = "http://10.0.20.15:11101";
        };
      };
    };
  };
}