From f4c07fb59c6a16d665534b666029426aa12e9f8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Fri, 14 Jan 2022 20:47:44 +0100 Subject: [PATCH] Add nginx to servers --- config/server.nix | 6 +++++- config/services/haproxy.nix | 2 -- config/services/nginx.nix | 27 +++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-) delete mode 100644 config/services/haproxy.nix create mode 100644 config/services/nginx.nix diff --git a/config/server.nix b/config/server.nix index bbfde1c3..2d0b5f82 100644 --- a/config/server.nix +++ b/config/server.nix @@ -1,2 +1,6 @@ # Configuration unique to servers -{ ... }: { } +{ ... }: { + imports = [ + ./services/nginx.nix + ]; +} diff --git a/config/services/haproxy.nix b/config/services/haproxy.nix deleted file mode 100644 index 58334e60..00000000 --- a/config/services/haproxy.nix +++ /dev/null @@ -1,2 +0,0 @@ -# Mostly future-proofing, but also for the transition to this infra -{ ... }: { } diff --git a/config/services/nginx.nix b/config/services/nginx.nix new file mode 100644 index 00000000..49fad650 --- /dev/null +++ b/config/services/nginx.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: { + services.nginx = { + additionalModules = [ pkgs.nginxModules.brotli ]; + clientMaxBodySize = "100m"; + enable = true; + httpConfig = '' + brotli on; + brotli_types + application/atom+xml + application/javascript + application/json + application/xml + application/xml+rss + image/svg+xml + text/css + text/javascript + text/plain + text/xml; + ''; + package = pkgs.nginxQuic; + recommendedGzipSettings = true; + recommendedOptimisation = true; + recommendedProxySettings = true; + resolver.addresses = [ "127.0.0.1" "[::1]" ]; + sslProtocols = "TLSv1.3"; + }; +}