在 Nginx 0.6.35 的版本中,配置多个 server 虚拟主机,必须要在配置文档中 http { 里头加上 server_names_hash_bucket_size 64; 这么一句

http {

server_names_hash_bucket_size 64;

include mime.types;
default_type application/octet-stream;
………….省略

}

不然不但 nginx 启动不了,而且 nginx -t 测试配置文档的时候会提示

could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32
2009/02/20 13:54:27 [emerg] 11372#0: the configuration file /opt/nginx/conf/nginx.conf test failed

  下面是在中文wiki上摘抄的一段说明
  保存服务器名字的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的提示,那么首要的是增大前一个参数的大小.

Nginx 的 server_names_hash_bucket_size 问题的更多相关文章

  1. FastDFS+Nginx部署详细教程

    本例使用到的所有tar和zip包地址:http://download.csdn.net/detail/corey_jk/9758664 本例中使用CentOS1.CentOS2两台机器实现. 1 GC ...

  2. Ubuntu 安装nginx

    https://www.nginx.com/resources/admin-guide/load-balancer/ https://github.com/gplessis/dotdeb-nginx/ ...

  3. 你需要知道的Nginx配置二三事

    做服务端开发的,工作中难免会遇到处理Nginx配置相关问题.在配置Nginx时,我一直本着“照葫芦画瓢”的原则,复制已有的配置代码,自己修修改改然后完成配置需求,当有人问起Nginx相关问题时,其实仍 ...

  4. nginx ubantu 安装步骤

    Ubuntu14.04默认安装的是Nginx 1.4.6 如果已经安装,请先卸载sudo apt-get remove nginx最新的稳定版Nginx 1.6.0在ubuntuupdates ppa ...

  5. Docker安装Nginx(含:Windows启动、重启、停止)

    Docker安装Nginx #docker pull nginx:latest (第一次启动Docker-Nginx) #docker run --detach \ --publish 80:80 \ ...

  6. nginx windows could not build server_names_hash, you should increase server_names_hash_bucket_size: 32

    nginx 为windows版本 在配置文件nginx.conf 的http{}段增加一行配置 server_names_hash_bucket_size 64; 如果64不够可以设128等

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

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

  8. 【记录】Nginx错误could not build the server_names_hash you should increase server_names_hash_bucket_size: 32

    今天遇到这个错误,现记录下解决方案: 在nginx的配置文件的http段中增加如下配置: server_names_hash_bucket_size 64; 下面是nginx官方文档解释: 如果定义了 ...

  9. nginx报警:nginx: [warn] could not build optimal server_names_hash, you should increase either server_names_hash_max_size: 512 or server_names_hash_bucket_size: 64; ignoring server_names_hash_bucket_size

    date: 2019-08-12   16:33:05 author: headsen chen notice :个人原创 告警现象:   解决办法:在http的部分添加hash缓冲值 测试:如下图, ...

随机推荐

  1. Hackonacci Matrix Rotations 观察题 ,更新了我的模板

    https://www.hackerrank.com/contests/w27/challenges/hackonacci-matrix-rotations 一开始是没想到观察题的.只想到直接矩阵快速 ...

  2. 开发一个 Web App 必须了解的那些事

    在过去的一年里,我在从头开始开发我的第一个重要的Web应用.经验教会了很多以前不知道的东西,特别是在安全性和用户体验方面. 值得一提的是,我上一次尝试构建的任何合理复杂性是在2005年.所以,在安全防 ...

  3. poj2393 Yogurt factory

    思路: 贪心. 实现: #include <iostream> #include <cstdio> #include <algorithm> using names ...

  4. SQL Case 语句的使用

    -----简单case 使用 select 学号,姓名, case 专业 when '金融系' then '1' when '材料成型及控制工程' then '2' else '3' end from ...

  5. 【PostgreSQL-9.6.3】一般视图

    PG视图分为两种,一种是物化视图,一种是一般视图.本篇文章主要写一般视图哪些事儿.所谓一般视图,通俗点说,就是由查询语句定义的虚拟表.视图中的数据可能来自一张或多张表. 1. 视图创建语句 CREAT ...

  6. vultr服务器L2TP搭建

    前期准备,购买外服,选择vultr服务商,可选择洛杉矶的,系统为Ubuntu 14.04 x64 一.安装L2TP/IPSec wget --no-check-certificate https:// ...

  7. 面试必备【含答案】Java面试题系列(二

    1.写clone()方法时,通常都有一行代码,是什么?答:super.clone(),他负责产生正确大小的空间,并逐位复制. 2.GC 是什么? 为什么要有GC?答:GC 是垃圾收集的意思(Gabag ...

  8. ALTER FUNCTION - 修改一个函数的定义

    SYNOPSIS ALTER FUNCTION name ( [ type [, ...] ] ) RENAME TO newname DESCRIPTION 描述 ALTER FUNCTION 修改 ...

  9. Adobe Dreamweaver CC 2014 代码颜色目录 dw

    他的颜色代码配置文件,不在安装目录下,这让我好找啊~ C:\Users\Administrator\AppData\Roaming\Adobe\Dreamweaver CC 2014\zh_CN\Co ...

  10. 哈尔滨工程大学ACM预热赛 补题

    链接:https://ac.nowcoder.com/acm/contest/554/A来源:牛客网 小虎刚刚上了幼儿园,老师让他做一个家庭作业:首先画3个格子,第二行有2个格子,第三行有1个格子. ...