nginx.nix 777 B

123456789101112131415161718192021222324252627282930313233
  1. { config, lib, pkgs, ... }:
  2. with lib;
  3. let
  4. cfg = config.roles.server.nginx;
  5. in {
  6. options.roles.server.nginx.enable = mkOption {
  7. default = false;
  8. type = types.bool;
  9. };
  10. config = mkIf cfg.enable {
  11. users.users.nginx.extraGroups = [ "acme" ];
  12. networking.firewall.allowedTCPPorts = [ 80 443 ];
  13. services.nginx = {
  14. enable = true;
  15. additionalModules = with pkgs.nginxModules; [ dav fancyindex ];
  16. appendConfig = mkDefault ''
  17. worker_processes 2;
  18. worker_cpu_affinity auto;
  19. '';
  20. eventsConfig = mkDefault ''
  21. worker_connections 1024;
  22. '';
  23. recommendedGzipSettings = true;
  24. recommendedOptimisation = true;
  25. recommendedProxySettings = true;
  26. recommendedTlsSettings = true;
  27. };
  28. };
  29. }