Chinaunix首页 | 论坛 | 博客
  • 博客访问: 288292
  • 博文数量: 57
  • 博客积分: 965
  • 博客等级: 准尉
  • 技术积分: 736
  • 用 户 组: 普通用户
  • 注册时间: 2011-08-24 10:22
文章分类

全部博文(57)

文章存档

2014年(2)

2013年(22)

2012年(25)

2011年(8)

分类: 系统运维

2013-06-07 17:56:54

     今天在给nginx添加几十个域名后,重启nginx的时候,报错如下:

[ sites]# /usr/local/nginx-1.0.11/sbin/nginx -t

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: 64
nginx: configuration file /usr/local/nginx-1.0.11/conf/nginx.conf test failed



         在nginx.conf配置文件的http{}把server_names_hash_bucket_size 128改为server_names_hash_bucket_size 512,按32的倍数往上加,再重启问题解决。
    

    最后查了下资料:

        保存服务器名字的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的提示,那么首要的是增大前一个参数的大小.

阅读(1350) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~