blob: db2d27dc247526edcb067649572d8af86c6cea49 (
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
|
{ config, lib, ... }:
with lib; let
cfg = config.local.web;
inherit (config.local) domains;
in
{
options.local.web = {
enable = mkEnableOption "web server";
};
config = mkIf cfg.enable {
services.nginx = {
enable = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
sslDhparam = config.security.dhparams.params.nginx.path;
clientMaxBodySize = "42M";
virtualHosts = {
${domains.host.www} = {
serverAliases = [ domains.host.main ];
useACMEHost = domains.host.main;
forceSSL = true;
};
};
};
security = {
acme.certs.${domains.host.main} = {
inherit (config.services.nginx) group;
};
dhparams.params.nginx = { };
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
local.certs.host.enable = true;
};
}
|