map_hash size #11

sivaji opened this Issue Jul 31, 2011 · 6 comments


None yet
3 participants

sivaji commented Jul 31, 2011

I have been testing nginx for one of our high profile drupal project. I came across your configuration in g.d.o, needless to say it is much saner. Thanks for sharing it.

Every time I configure nginx it throws me map_hash size error. The error message reads as below,

[emerg]: could not build the map_hash, you should increase map_hash_bucket_size: 64

Adding map_hash_bucket_size 192; in blacklist.conf seems to solve the issue for me however i'm not sure whether it is a right fix or not.

I would love to hear from you about the issue and fix I have applied. Sharing it with an intend to make your configuration still saner. Thanks.

perusio was assigned Jul 31, 2011


perusio commented Jul 31, 2011

Hello sivaji,

Thank you for your appreciation of the config. I try to make it as secure and as fast as possible. There are some things that can be improved like using literal matches for the imagecache handing. I'm working on that. It requires a tiny module for "sniffing" the files path.

As per the issue you're reporting: that's probably because a lot of UA are matching with the regexes defined in the map directive that implements the black list.

AFAIK, that's a performance issue. The smaller the size, the faster is the search for the values in the hash table. Perhaps you already tried that, but progressing in byte multiples is a good idea. Try starting with 96 and see of it complains. If so then set it at 128, and so on.

You're right that needs a note on the docs. I think a FAQ is in order.

Thank you,

sivaji commented Aug 3, 2011

Hi perusio,

Thanks for your quick repose. Wish I will catch up with your speed :-). 192 is the the least value for which it works fine for me.

Also I would like to see some mentions in FAQ to tweak your configuration for drupal installed in sub-directory. I manged to get this working with a dirty workaround.


perusio commented Aug 4, 2011

Hello sivaji,

I've gave it some thought and the best option IMO is to expand the Nginx Fast Config module to generate the config. This way it will adapt to whatever setup you have, including running drupal on a subdir.

Since the config uses exact locations = you have to prefix the dir to each one, e.g., location = /subdir/index.php {...

fiasco commented Aug 15, 2011

I've got the same issue for a Drupal 7 site I'm setting up. Could I suggest you put a commented out configuration setting in your nginx.conf? That way, when someone greps for map_hash_bucket_size, they find where to set it.


perusio commented Aug 16, 2011

@fiasco, @sivaji, new there's a commented setting of map_hash_bucket_size in nginx.conf.

fiasco commented Aug 16, 2011

Great thanks very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment