···129129 ''));
130130131131 commonHttpConfig = ''
132132- # Load mime types.
132132+ # Load mime types and configure maximum size of the types hash tables.
133133 include ${cfg.defaultMimeTypes};
134134- # When recommendedOptimisation is disabled nginx fails to start because the mailmap mime.types database
135135- # contains 1026 entries and the default is only 1024. Setting to a higher number to remove the need to
136136- # overwrite it because nginx does not allow duplicated settings.
137137- types_hash_max_size 4096;
134134+ types_hash_max_size ${toString cfg.typesHashMaxSize};
138135139136 include ${cfg.package}/conf/fastcgi.conf;
140137 include ${cfg.package}/conf/uwsgi_params;
···894891 description = ''
895892 Sets the maximum size of the server names hash tables.
896893 '';
894894+ };
895895+896896+ typesHashMaxSize = mkOption {
897897+ type = types.ints.positive;
898898+ default = if cfg.defaultMimeTypes == "${pkgs.mailcap}/etc/nginx/mime.types" then 2688 else 1024;
899899+ defaultText = literalExpression ''if cfg.defaultMimeTypes == "''${pkgs.mailcap}/etc/nginx/mime.types" then 2688 else 1024'';
900900+ description = ''
901901+ Sets the maximum size of the types hash tables (`types_hash_max_size`).
902902+ It is recommended that the minimum size possible size is used.
903903+ If {option}`recommendedOptimisation` is disabled, nginx would otherwise
904904+ fail to start since the mailmap `mime.types` database has more entries
905905+ than the nginx default value 1024.
906906+ '';
897907 };
898908899909 proxyCachePath = mkOption {