In nginx 0.6.35, to configure multiple server virtual hosts, you must add server_names_hash_bucket_size 64 in HTTP {.
HTTP {
Server_names_hash_bucket_size 64;
Include mime. types;
Default_type application/octet-stream;
............. Omitted
}
Otherwise, not only does nginx fail to be started, but the nginx-T will prompt you when testing the configuration document.
Cocould not build the server_names_hash, you shocould increase server_names_hash_bucket_size: 32
2009/02/20 13:54:27 [emerg] 11372 #0: the configuration file/opt/nginx/CONF/nginx. conf test failed
The following is an excerpt from the Chinese wiki.
The hash table that saves 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 cache size of a single processor. After reducing the number of accesses in the memory, it is possible to accelerate the search for hash table key values in the processor. If the size of the hash bucket is equal to the cache size of one processor, the number of times the hash bucket is searched in the memory is 2 in the worst case when the search key is used. 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 prompts you to increase the hash Max size or hash bucket size, increase the size of the previous parameter first.