Mar 19

Solved – nginx could not build the server_names_hash

In Nginx environment, you may be experienced following error message saying you should have to increase server_names_hash_bucket_size.



Error message:-  nginx: [emerg] could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32
nginx: configuration file /etc/nginx/nginx.conf test failed.  


This error is due to using large server_name which does not fit in the hash bucket. It is recommended to use small values as where as possible, because it can directly impact the web server performance as server_name is being looked up on every request. you can find setting up hashes from here.

Solution :- Add following line to nginx.conf
server_names_hash_bucket_size 64;

then test the nginx config, if it is success you can reload / restart Nginx.
#sudo nginx -t
#sudo nginx reload


  1. pauli

    wow, this is really useful to me. 🙂

  2. Vitor de Souza

    In my case I had to change to 128.

Leave Your Thought Here