nginx问题之nginx: could not build server_names_hash, you should increase server_names_hash_bucket_size解...

昨天在nginx上部署了一个网站后,发现访问不了,再去访问之前部署的网站,发现都访问不了了,去看下下nginx,发现nginx服务停止了,没有在运行,重启了下服务,发现还是一样,就去看了下nginx的日志,发下下面这样的提示:

看到什么server_names_hash_bucket_size之类的,我猜测是部署网站的时候,起的主机名称太长了,改小后果然,重启nginx,马上就好了。

解决方案:

 edit the http{} nginx configuration

http {
    server_names_hash_bucket_size 64;
    ...
}
  • The default value of server_names_hash_bucket_size depends on the size of the processor’s cache line
  • If a large number of server names are defined, or unusually long server names are defined, tuning the server_names_hash_max_size and server_names_hash_bucket_size directives at the http level may become necessary.
  • If the default value of server_names_hash_bucket_size used at the server is not enough, means nginx complained with could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32, the directive value should be increased to the next power of two (e.g. in this case to 64).
  • If a large number of server names are defined, and nginx complained with the following error could not build the server_names_hash, you should increase either server_names_hash_max_size: 512 or server_names_hash_bucket_size: 32. try to set server_names_hash_max_size to a number close to the number of server names. Only if this does not help, or if nginx’s start time is unacceptably long, try to increase server_names_hash_bucket_size.
  • The hash bucket size parameter is aligned to the size that is a multiple of the processor’s cache line size

转载于:https://www.cnblogs.com/Steven-shi/p/8241162.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值