zoukankan      html  css  js  c++  java
  • nginx报错”could not build the server_names_hash”

    今天在给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的提示,那么首要的是增大前一个参数的大小.

  • 相关阅读:
    winform音频播放器(有声小说[凡人修仙传])
    c# 小小备忘录
    编程语言 : Java的动态Web解决方案泛谈
    服务器 : Apache Tomcat
    荐书 : 调试九法
    框架应用 : Spring MVC
    框架应用 : Spring
    数据库 : Mysql
    框架应用:Mybatis
    String对象的一些函数用法与心得
  • 原文地址:https://www.cnblogs.com/zhxlsuyu/p/2545289.html
Copyright © 2011-2022 走看看