Nginx add dozens of domain names

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.