nginx: [warn] could not build optimal proxy_headers_hash, you should increase either proxy_headers_hash_max_size: 512 or proxy_headers_hash_bucket_size: 64; ignoring proxy_headers_hash_bucket_sizeが出てきたので対策しました。

起動時に下記のエラーが出ていたので対策しました。

# sudo nginx -t
nginx: [warn] could not build optimal proxy_headers_hash, you should increase either proxy_headers_hash_max_size: 512 or proxy_headers_hash_bucket_size: 64; ignoring proxy_headers_hash_bucket_size
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

下記を追加します。

        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;    

    中略

    #↓2つを追加
    proxy_headers_hash_max_size 512;
    proxy_headers_hash_bucket_size 128;

エラーはなくなりました。

root@ホスト名:/etc/nginx/sites-available# sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
root@ホスト名:/etc/nginx/sites-available#

コメントを残す

メールアドレスが公開されることはありません。 ※ が付いている欄は必須項目です