summaryrefslogtreecommitdiff
path: root/hosts/experimental-nixos/services/nginx.nix
blob: fa857dbb0341d27a4895bb5925569ba40c5ae83b (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{
  services.nginx.enable = true;
  services.nginx.enableReload = true;

  users.users.nginx.extraGroups = ["acme"];
  services.nginx.virtualHosts."m4siri.com" = {
    http2 = true;
    addSSL = true;
    useACMEHost = "m4siri.com";

    locations."/molly" = {
      proxyPass = "http://localhost:8091/";
      extraConfig = ''
        proxy_set_header Host $host;
        proxy_set_header X-Original-URL $request_uri;
      '';
    };

  };
  services.nginx.virtualHosts."mail.m4siri.com" = {
    http2 = true;
    addSSL = true;
    useACMEHost = "mail.m4siri.com";

    locations."/" = {
      proxyPass = "http://localhost:8080";
      proxyWebsockets = true;
    };

    locations."/.well-known/jmap" = {
      proxyPass = "https://localhost:1443";
    };

    locations."/jmap/session" = {
      proxyPass = "https://localhost:1443";
    };

    locations."/jmap" = {
      proxyPass = "http://localhost:8080";
      proxyWebsockets = true;
    };
  };

  services.nginx.virtualHosts."ntfy.m4siri.com" = {
    http2 = true;
    addSSL = true;
    useACMEHost = "ntfy.m4siri.com";

    locations."/" = {
      proxyPass = "http://localhost:8090";
      proxyWebsockets = true;
      extraConfig = ''
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
      '';
    };
  };

  services.nginx.virtualHosts."shashwothapa.com.np" = {
    http2 = true;
    addSSL = true;
    useACMEHost = "shashwothapa.com.np";

    locations."/" = {
      return = "418";
    };
  };

  services.nginx.virtualHosts."mail.shashwothapa.com.np" = {
    http2 = true;
    addSSL = true;
    useACMEHost = "mail.shashwothapa.com.np";

    locations."/" = {
      proxyPass = "http://localhost:8080";
      proxyWebsockets = true;
    };
  };
}