Today after adding dozens of domain names to nginx, when restarting Nginx, error "[Emerg]: Could not build the Server_names_hash, you should increase either Server_names_ hash_max_size:512 or Server_names_hash_bucket_size:128″
In the nginx.conf configuration file http{} server_names_hash_bucket_size 128 changed to Server_names_hash_bucket_size 512, in multiples of 32 to add, and then restart the problem resolved.
[Email protected] vhost]#/usr/local/nginx/sbin/nginx-t
[Emerg]: Could not build the Server_names_hash, you should increase either server_names_hash_max_size:512 or server_names _hash_bucket_size:128
Configuration file/usr/local/nginx/conf/nginx.conf test Failed
[Email protected] vhost]#/usr/local/nginx/sbin/nginx-t
The configuration file/usr/local/nginx/conf/nginx.conf syntax is OK
Configuration file/usr/local/nginx/conf/nginx.conf test is successful
Finally, we looked up the following information:
The hash table that holds the server name is controlled by the command server_names_hash_max_size and Server_names_hash_bucket_size. The parameter hash bucket size is always equal to the size of the hash table and is a multiple of the processor cache size. After reducing the number of accesses in memory, it is possible to speed up the lookup of hash table key values in the processor. If a hash bucket size equals the size of a processor cache, the worst case lookup of a key is 2 in memory. The first is to determine the address of the storage unit, and the second is to find the key value in the storage unit. Therefore, if Nginx gives the hint to increase the hash max size or hash bucket size, it is important to increase the size of the previous parameter.
This article is from the "Freeterman" blog, make sure to keep this source http://myunix.blog.51cto.com/191254/1622277
Nginx add dozens of domain names