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

你可能感兴趣的:(Nginx:could not build optimal server_names_hash)