summaryrefslogtreecommitdiff
path: root/flora/services/nginx.nix
blob: 1d952551b34369d7122cb7c7131bdcd802884c9a (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
{ 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.socketAddress};
        include       ${pkgs.nginx}/conf/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME     ${lib.getExe pkgs.nomsring};
        fastcgi_param PATH_INFO           $1;
      '';
    };
  };
  services.fcgiwrap.enable = true;
}