Nginx:could not build optimal server_names_hash

[root@localhost sbin]# ./nginx -t
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

解决方法是在 nginx 配置文件的 http 段中增加如下配置:

[root@localhost conf]# vi nginx.conf
...
http {
    ...
    server_names_hash_max_size 512;
    server_names_hash_bucket_size 128;
    ...
}
...
esc键,输入:wq    #保存退出

重新输入nginx -t 校验配置文件:

[root@localhost sbin]# ./nginx -t
nginx: the configuration file /usr/local/nginx//conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx//conf/nginx.conf test is successful
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容