记录Nginx错误could not build the server_names_hash you should increase server_names_hash_bucket_size:

Posted wbl001

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了记录Nginx错误could not build the server_names_hash you should increase server_names_hash_bucket_size:相关的知识,希望对你有一定的参考价值。

今天遇到这个错误,现记录下解决方案:

nginx的配置文件的http段中增加如下配置:

server_names_hash_bucket_size 64;

 

下面是nginx官方文档解释:

如果定义了大量名字,或者定义了非常长的名字,那可能需要在http配置块中使用server_names_hash_max_size和server_names_hash_bucket_size指令进行调整。server_names_hash_bucket_size的默认值可能是32,或者是64,或者是其他值,取决于CPU的缓存行的长度。如果这个值是32,那么定义“too.long.server.name.example.org”作为虚拟主机名就会失败,而nginx显示下面错误信息:
could not build the server_names_hash,
you should increase server_names_hash_bucket_size: 32
出现了这种情况,那就需要将指令的值扩大一倍:

http 
    server_names_hash_bucket_size  64;
    ...
如果定义了大量名字,得到了另外一个错误:

could not build the server_names_hash,
you should increase either server_names_hash_max_size: 512
or server_names_hash_bucket_size: 32
那么应该先尝试设置server_names_hash_max_size的值差不多等于名字列表的名字总量。如果还不能解决问题,或者服务器启动非常缓慢,再尝试提高server_names_hash_bucket_size的值。

  

以上是关于记录Nginx错误could not build the server_names_hash you should increase server_names_hash_bucket_size:的主要内容,如果未能解决你的问题,请参考以下文章

错误记录安卓编译错误 ( Could not find xxx.tools.build:aapt2 )

错误记录Android Studio 编译报错 ( Could not find com.android.tools.build:gradle:4.2.1. )

Nginx: could not build the server_names_hash 解决办法

错误记录Mac 中 Python 报错 ( ERROR: Could not build wheels for numpy which use PEP 517 and cannot be in )(代

Could not find com.android.tools.build:gradle:3.0.0-alpha3

Maven项目出现 could not calculate build plan:plugin 错误