Solving could should increase server_names_hash_bucket_size: 32 NGINX Ubuntu


After I configure several sites that have a long names in NGINX virtualhost, I restart my NGINX and got this error :

1
2
3
sudo service nginx restart
Restarting nginx: nginx: [emerg] could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32
nginx: configuration file /etc/nginx/nginx.conf test failed

Well this is because my NGINX conf only limit server_name into 32 chars. We need to extend it by uncomment “server_names_hash_bucket_size 64;” in nginx.conf :

/etc/nginx/nginx.conf :

1
2
3
4
5
6
7
http {
     ….
     server_names_hash_bucket_size 64;
     # server_name_in_redirect off;

     ….
}

Problem solved! 😀


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.