dotfiles/system/nixos/nginx.nix

36 lines
929 B
Nix
Raw Normal View History

{ pkgs, ... }:
2023-03-06 09:21:34 +00:00
2023-03-05 22:51:30 +00:00
{
services.nginx = {
enable = true;
2023-10-05 11:13:12 +00:00
package = pkgs.nginxQuic.override {
withKTLS = true;
};
2023-03-06 09:21:34 +00:00
2023-03-05 22:51:30 +00:00
recommendedOptimisation = true;
recommendedGzipSettings = true;
recommendedBrotliSettings = true;
2023-07-05 21:55:20 +00:00
recommendedZstdSettings = true;
2023-03-05 22:51:30 +00:00
recommendedTlsSettings = true;
2023-03-13 22:28:01 +00:00
commonHttpConfig = ''
map $remote_addr $remote_addr_anon {
~(?P<ip>\d+\.\d+\.\d+)\. $ip.0;
~(?P<ip>[^:]+:[^:]+): $ip::;
default 0.0.0.0;
}
log_format combined_anon '$remote_addr_anon - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
2023-03-13 22:42:19 +00:00
access_log /var/log/nginx/access.log combined_anon buffer=32k flush=5m;
2023-03-13 22:28:01 +00:00
'';
2023-09-18 07:08:33 +00:00
2023-09-22 22:00:05 +00:00
# Currently breaks HTTP3
# appendConfig = ''
# worker_processes auto;
# '';
2023-03-05 22:51:30 +00:00
};
}