Summary Files Commits Branches @commit @diff @stats
path: root / machines / uttu / httpd.nix
blob: ca215d71eb28674dc36ed61fe8e8c37818021082 (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
{ config, ... }: let
  inherit (config.srv) tld;
in {
  srv.slds = [ "server" "ftp" "samba" ];

  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>
        '';
      };
    };
  };
}