summaryrefslogtreecommitdiff
path: root/flora/services/nginx.nix
blob: 4a9bf336e58b958653639c6993bb0102974d5e17 (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
{ config, lib, pkgs, ... }:

{
  networking.firewall.allowedTCPPorts = [ 80 443 ];

  services.nginx = {
    enable = true;
    
    recommendedOptimisation = true;
    recommendedTlsSettings = true;
    recommendedProxySettings = true;

    virtualHosts."noms.ing" = {
      enableACME = true;
      forceSSL = true;
      locations."/".root = ../../pkgs/nomsing;
    };
    virtualHosts."meow.noms.ing" = {
      enableACME = true;
      forceSSL = true;
      locations."/".root = ../../pkgs/nomsing;
    };
    virtualHosts."webring.noms.ing" = {
      enableACME = true;
      forceSSL = true;
      locations."~ (.*)".extraConfig = ''
        fastcgi_pass  unix:${config.services.fcgiwrap.instances.nomsing.socket.address};
        include       ${pkgs.nginx}/conf/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME     ${lib.getExe pkgs.nomsring};
        fastcgi_param PATH_INFO           $1;
      '';
    };
  };

  services.fcgiwrap.instances.nomsing = {
    socket = {
      user = "nomsring";
      group = "users";
      mode = "0622";
    };
  };

  users.users.nomsring = {
    isSystemUser = true;
    group = "users";
  };
}