DBMNG数据库管理与应用

所有存在都是独创。
当前位置:首页 > 服务器配置 > nginx

nginx报错”nginx: [emerg] could not build server_names_hash, you should increase server_names

nginx: [emerg] could not build server_names_hash, you should increase server_nam es_hash_bucket_size: 32

今天在给nginx添加几十个域名后,重启nginx的时候,报错”[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″

在nginx.conf配置文件的http{}把server_names_hash_bucket_size 128改为server_names_hash_bucket_size 512,按32的倍数往上加,再重启问题解决。
[root@localhost 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
[root@localhost 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
最后查了下资料:
保存服务器名字的hash表是由指令 server_names_hash_max_size 和 server_names_hash_bucket_size所控制的。参数hash bucket size总是等于hash表的大小,并且是一路处理器缓存大小的倍数。在减少了在内存中的存取次数后,使在处理器中加速查找hash表键值成为可能。如果 hash bucket size等于一路处理器缓存的大小,那么在查找键的时候,最坏的情况下在内存中查找的次数为2。第一次是确定存储单元的地址,第二次是在存储单元中查找键值。因此,如果Nginx给出需要增大 hash max size 或 hash bucket size的提示,那么首要的是增大前一个参数的大小.
本站文章内容,部分来自于互联网,若侵犯了您的权益,请致邮件chuanghui423#sohu.com(请将#换为@)联系,我们会尽快核实后删除。
Copyright © 2006-2023 DBMNG.COM All Rights Reserved. Powered by DEVSOARTECH            豫ICP备11002312号-2

豫公网安备 41010502002439号