nginx: enable http3

This commit is contained in:
Rouven Seifert 2024-04-03 00:01:40 +02:00
parent 1b3c8721ec
commit 02f075b615
Signed by: rouven.seifert
GPG key ID: B95E8FE6B11C4D09
2 changed files with 8 additions and 2 deletions

View file

@ -14,6 +14,7 @@
extraConfig = '' extraConfig = ''
access_log /var/log/nginx/${name}_access.log; access_log /var/log/nginx/${name}_access.log;
error_log /var/log/nginx/${name}_error.log; error_log /var/log/nginx/${name}_error.log;
add_header Alt-Svc 'h3=":443"; ma=86400';
''; '';
}) })
); );

View file

@ -1,4 +1,4 @@
{ lib, config, ... }: { pkgs, lib, config, ... }:
{ {
# set default options for virtualHosts # set default options for virtualHosts
options = with lib; { options = with lib; {
@ -8,9 +8,13 @@
# split up nginx access logs per vhost # split up nginx access logs per vhost
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
# enable http3 for all hosts
quic = true;
http3 = true;
extraConfig = '' extraConfig = ''
access_log /var/log/nginx/${name}_access.log; access_log /var/log/nginx/${name}_access.log;
error_log /var/log/nginx/${name}_error.log; error_log /var/log/nginx/${name}_error.log;
add_header Alt-Svc 'h3=":443"; ma=86400';
''; '';
}) })
); );
@ -18,13 +22,14 @@
}; };
config = { config = {
networking.firewall.allowedTCPPorts = [ 80 443 ]; networking.firewall.allowedTCPPorts = [ 80 443 ];
networking.firewall.allowedUDPPorts = [ 443 ];
services.nginx = { services.nginx = {
enable = true; enable = true;
package = pkgs.nginxQuic;
recommendedTlsSettings = true; recommendedTlsSettings = true;
recommendedProxySettings = true; recommendedProxySettings = true;
recommendedGzipSettings = true; recommendedGzipSettings = true;
recommendedOptimisation = true; recommendedOptimisation = true;
# virtualHosts = lib.genAttrs v (name: { extraConfig = " lohustuff goes ith ${name}"; });
}; };
security.acme = { security.acme = {
acceptTerms = true; acceptTerms = true;