depot/cluster/services/nginx/nginx.nix

39 lines
1.3 KiB
Nix
Raw Normal View History

2022-10-17 15:54:48 +03:00
{ config, tools, ... }:
2021-10-16 21:16:46 +03:00
let
2022-09-02 00:05:39 +03:00
inherit (tools.meta) adminEmail;
in {
2022-05-30 23:19:26 +03:00
security.acme.defaults.email = adminEmail;
2021-10-16 21:16:46 +03:00
security.acme.acceptTerms = true;
services.nginx = {
enable = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
recommendedOptimisation = true;
recommendedGzipSettings = true;
proxyResolveWhileRunning = false;
resolver = {
addresses = [ "127.0.0.1" ];
valid = "30s";
};
appendHttpConfig = ''
server_names_hash_bucket_size 128;
proxy_headers_hash_max_size 4096;
proxy_headers_hash_bucket_size 128;
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
'';
};
services.phpfpm.pools.www = {
inherit (config.services.nginx) user group;
settings = {
pm = "ondemand";
"pm.max_children" = 16;
"listen.owner" = config.services.nginx.user;
"listen.group" = config.services.nginx.group;
};
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
2021-12-03 01:13:33 +02:00
systemd.services.nginx.after = [ "network-online.target" ];
2021-10-16 21:16:46 +03:00
}