Summary Files Commits Branches @commit @diff @stats
path: root / machines / marduk / httpd.nix
blob: eb6d8afe48ab1c628269f0d03a892eba30c5766f (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
{ config, ... }: let
  inherit (config.constants) ip tld;
in {
  services.dnsmasq.settings.address = [
    "/server.${tld}/ftp.${tld}/samba.${tld}/${ip}"
  ];

  services.httpd = {
    virtualHosts = {
      "server.${tld}" = {
        listen = [ { port = 80; } ];
        documentRoot = "/var/www/server";
        locations."/server-status".extraConfig = ''
          SetHandler server-status
        '';
      };

      #== File servers ==#

      "samba.${tld}" = rec {
        listen = [ { port = 80; } ];
        documentRoot = "/NetworkDirectory";
        extraConfig = ''
          <Directory "${documentRoot}">
              IndexOptions +NameWidth=* +Charset=UTF-8
          </Directory>
        '';
      };
      "ftp.${tld}" = rec {
        listen = [ { port = 80; } ];
        documentRoot = "/home/ftp";
        extraConfig = ''
          <Directory "${documentRoot}">
              IndexOptions +NameWidth=* +Charset=UTF-8
          </Directory>
        '';
      };
    };
  };
}