The operating system is centos 7.2, use
# /usr/sbin/nginx -s reload
When reloading the nginx configuration, the following information is displayed:
[root@i001 ~]# /usr/sbin/nginx -s reload
nginx: [warn] could not build optimal server_names_hash, you should increase either server_names_hash_max_size: 512 or server_names_hash_bucket_size: 64; ignoring server_names_hash_bucket_size
Let addserver_names_hash_max_size: 512
,
or server_names_hash_bucket_size: 64
,
Ignoreserver_names_hash_bucket_size
,
The question is:
1. In what file does it need to be added?
2. What is the format? Is there a semicolon or something like that? I tried it but it was always wrong.
3. Ignoreserver_names_hash_bucket_size
Does it mean to delete this item when you see it?
给我你的怀抱2017-05-16 17:20:01
Solution
Add this sentence to http{} in /usr/local/nginx/conf/nginx.conf
server_names_hash_max_size 512;
Use sudo /usr/local/nginx/sbin/nginx -t to check the nginx configuration file, if there is still a prompt
could not build the server_names_hash, you should increase either server_names_hash_max_size: 512 or server_names_hash_bucket_size: 64
Then increase server_names_hash_max_size
server_names_hash_max_size 1024;
Error reason
The hash table that saves server names is controlled by the instructions 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 search for hash table key values in the processor. If the hash bucket size is equal to the size of the processor cache, then when searching for a key, the number of searches in the memory is 2 in the worst case. The first time is to determine the address of the storage unit, and the second time is to find the key value in the storage unit. Therefore, if Nginx gives a prompt that the hash max size or hash bucket size needs to be increased, the first thing to do is to increase the size of the previous parameter.