server_names_hash_bucket_size

nginxで表題に関するwarningが出ていた。

■ 環境

  • nginx 1.12.1
  • CentOS 6.9

■ server_names_hash_bucket_size

設定を変更したので`configtest`で確認してみたところ、下記のwarningが出力されていた。

$ /usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/etc/nginx.conf
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: the configuration file /usr/local/nginx/etc/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/etc/nginx.conf test is successful
$

今回大量に”server“コンテキストを追加していたので、”server_names_has_max_size 512“に引っかかったのかと思ったが、大量とはいえどもそこまで追加していない。どうやら”server_names_hash_bucket_size 64“の方に引っかかっていたようである。”server_name“に長い名前が付いているとこのメッセージが出るようだ。

nginx.conf“の”http“コンテキストに下記を追加したところwarningは出力されなくなった。

server_names_hash_bucket_size 128;

以上。