Nginx won’t restart after update; config test fails with ‘could not build the types_hash’

configurationnginxweb-server

I just updated nginx to 0.8.50 (as provided by the nginx development PPA), but now I'm facing a problem. I can't restart my server anymore, as it says 'Testing nginx configuration: [emerg]: could not build the types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 32'. The thing is, it worked perfectly fine before. I don't know what could have triggered the error.

What I tried:

  • Increasing the types_hash_bucket_size/types_hash_max_size values, I'm currently using server_names_hash_bucket_size 512; server_names_hash_max_size 2048, which should be more than enough for my (max) 20 vhosts. But when running config test, the problem persists.
  • Also, I tried disabling some of my vhosts. When I disable them all, the problem is gone. When I load one the problem is there, it does not matter which config I try.

My Config:
http://pastie.org/private/jcmahbdftqkhtap4au1izw

I hope someone can help me out here, I'm quite lost.

Best Answer

So, this was really stupid. Since I couldn't find anything about types_hash_bucket_size / types_hash_max_size in the docs, I figured the variable names where wrong and should be server_names_hash_bucket_size / server_names_hash_max_size, which are mentioned in the wiki. I was wrong, the variable names where right, and after increasing them everything went back to normal.