summaryrefslogtreecommitdiff
path: root/hosts/p-body/nginx.nix
blob: d52473ce9a821f824cbd9829189a51bb67c9b574 (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
{
  config,
  self,
  ...
}: let
  inherit (config.networking) domain;
  inherit (self.lib.utils.nginx) mkProxy mkVHosts;
in {
  server = {
    acme.enable = true;
    services.cloudflared.enable = true;
  };

  services.nginx = {
    enable = true;

    recommendedGzipSettings = true;
    recommendedOptimisation = true;
    recommendedProxySettings = true;
    recommendedTlsSettings = true;

    virtualHosts = mkVHosts {
      "api.${domain}" = {
        locations = mkProxy "/" "8080";
      };

      "grafana.${domain}" = {
        locations = mkProxy "/" "4000";
      };
    };
  };
}