2024-08-10 14:35:40 +03:00
|
|
|
{ config, ... }:
|
2021-10-16 21:16:46 +03:00
|
|
|
|
2024-08-10 14:35:40 +03:00
|
|
|
{
|
2021-10-16 21:16:46 +03:00
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
recommendedTlsSettings = true;
|
|
|
|
recommendedOptimisation = true;
|
|
|
|
recommendedGzipSettings = true;
|
2024-04-22 00:41:13 +03:00
|
|
|
proxyResolveWhileRunning = true;
|
2021-10-16 21:16:46 +03:00
|
|
|
resolver = {
|
2024-08-02 23:46:05 +03:00
|
|
|
addresses = config.networking.nameservers;
|
2021-10-16 21:16:46 +03:00
|
|
|
valid = "30s";
|
|
|
|
};
|
|
|
|
appendHttpConfig = ''
|
|
|
|
server_names_hash_bucket_size 128;
|
2021-12-04 02:27:37 +02:00
|
|
|
proxy_headers_hash_max_size 4096;
|
|
|
|
proxy_headers_hash_bucket_size 128;
|
2022-05-16 01:10:14 +03:00
|
|
|
log_format fmt_loki 'host=$host remote_addr=$remote_addr remote_user=$remote_user request="$request" status=$status body_bytes_sent=$body_bytes_sent http_referer="$http_referer" http_user_agent="$http_user_agent"';
|
|
|
|
access_log syslog:server=unix:/dev/log,tag=nginx_access,nohostname fmt_loki;
|
2021-10-16 21:16:46 +03:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
2024-06-04 19:49:07 +03:00
|
|
|
systemd.services.nginx = {
|
|
|
|
after = [ "network-online.target" ];
|
|
|
|
wants = [ "network-online.target" ];
|
|
|
|
};
|
2021-10-16 21:16:46 +03:00
|
|
|
}
|