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 :


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 :

http {
....
server_names_hash_bucket_size 64;
# server_name_in_redirect off;

....
}

Problem solved! :D