summaryrefslogtreecommitdiff
path: root/hosts/surtr/http/default.nix
blob: 6b516b00ef86ee811b656f08ee267105ab2814ee (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
{ config, lib, pkgs, ... }:
{
  imports = [
    ./webdav
  ];

  config = {
    services.nginx = {
      enable = true;
      package = pkgs.nginxQuic;
      recommendedGzipSettings = true;
      recommendedProxySettings = true;
      recommendedTlsSettings = true;
      sslDhparam = config.security.dhparams.params.nginx.path;
      commonHttpConfig = ''
        ssl_ecdh_curve X448:X25519:prime256v1:secp521r1:secp384r1;

        log_format main
                '$remote_addr "$remote_user" '
                '"$host" "$request" $status $bytes_sent '
                '"$http_referer" "$http_user_agent" '
                '$gzip_ratio';

        access_log syslog:server=unix:/dev/log main;
        error_log syslog:server=unix:/dev/log info;

        client_body_temp_path /run/nginx-client-bodies;
      '';
      additionalModules = with pkgs.nginxModules; [ pam ];
    };
    systemd.services.nginx = {
      preStart = lib.mkForce config.services.nginx.preStart;
      serviceConfig = {
        SupplementaryGroups = [ "shadow" ];
        ExecReload = lib.mkForce "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
        RuntimeDirectory = lib.mkForce [ "nginx" "nginx-client-bodies" ];
        RuntimeDirectoryMode = "0750";
      };
    };

    services.uwsgi = {
      enable = true;
      plugins = ["python3"];
      instance = {
        type = "emperor";
        vassals = {};
      };
    };
  };
}