···129 ''));
130131 commonHttpConfig = ''
132- # Load mime types.
133 include ${cfg.defaultMimeTypes};
134- # When recommendedOptimisation is disabled nginx fails to start because the mailmap mime.types database
135- # contains 1026 entries and the default is only 1024. Setting to a higher number to remove the need to
136- # overwrite it because nginx does not allow duplicated settings.
137- types_hash_max_size 4096;
138139 include ${cfg.package}/conf/fastcgi.conf;
140 include ${cfg.package}/conf/uwsgi_params;
···894 description = ''
895 Sets the maximum size of the server names hash tables.
896 '';
0000000000000897 };
898899 proxyCachePath = mkOption {
···129 ''));
130131 commonHttpConfig = ''
132+ # Load mime types and configure maximum size of the types hash tables.
133 include ${cfg.defaultMimeTypes};
134+ types_hash_max_size ${toString cfg.typesHashMaxSize};
000135136 include ${cfg.package}/conf/fastcgi.conf;
137 include ${cfg.package}/conf/uwsgi_params;
···891 description = ''
892 Sets the maximum size of the server names hash tables.
893 '';
894+ };
895+896+ typesHashMaxSize = mkOption {
897+ type = types.ints.positive;
898+ default = if cfg.defaultMimeTypes == "${pkgs.mailcap}/etc/nginx/mime.types" then 2688 else 1024;
899+ defaultText = literalExpression ''if cfg.defaultMimeTypes == "''${pkgs.mailcap}/etc/nginx/mime.types" then 2688 else 1024'';
900+ description = ''
901+ Sets the maximum size of the types hash tables (`types_hash_max_size`).
902+ It is recommended that the minimum size possible size is used.
903+ If {option}`recommendedOptimisation` is disabled, nginx would otherwise
904+ fail to start since the mailmap `mime.types` database has more entries
905+ than the nginx default value 1024.
906+ '';
907 };
908909 proxyCachePath = mkOption {