Increase server_names_hash_bucket_size

How to fix Nginx config when you have many domains or long domain names

If Nginx complains with the following message, you must increase the bucket size of the hash tables it uses internally:

nginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 64

You must increase this value to the next power of 2, i.e. to 128 in this example. For this, please follow these steps:

  • Log into your server as user moss
  • Run these commands (use the appropriate bucket size):
sudo suecho "server_names_hash_bucket_size 128;" > /usr/local/openresty/nginx/sites/server_names
  • Log into Moss and Set up the site