infra/roles/nginx.nix

39 lines
1.2 KiB
Nix
Raw Normal View History

2022-12-31 07:24:17 +01:00
{ config, ... }:
2021-03-04 11:02:47 +01:00
{
2021-03-04 11:05:17 +01:00
networking.firewall.allowedTCPPorts = [ 443 80 ];
2021-03-04 11:02:47 +01:00
# nginx is being used as the frontend HTTP server for all the services
# running on the box
2021-03-04 11:05:17 +01:00
services.nginx = {
enable = true;
2021-03-04 11:02:47 +01:00
2021-03-04 11:05:17 +01:00
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
# Should we have this?
#commonHttpConfig = ''
# add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload' always;
#'';
resolver.addresses =
if config.networking.nameservers == [ ]
then [ "1.1.1.1" ]
else config.networking.nameservers;
sslDhparam = config.security.dhparams.params.nginx.path;
# FIXME:
# nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory)
# 2022/12/23 02:57:47 [emerg] 7#7: BIO_new_file("/var/lib/dhparams/nginx.pem") failed (SSL: error:80000002:system library::No such file or directory:calling fopen(/var/lib/dhparams/nginx.pem, r) error:10000080:BIO routines::no such file)
validateConfig = false;
2021-03-04 11:05:17 +01:00
};
security.dhparams = {
enable = true;
params.nginx = { };
};
2021-03-04 11:02:47 +01:00
}