The last time I have restarted nginx after a minor change I came across this error:
Oct 02 15:48:57 v2202207179944196310 nginx[28113]: nginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 32
Oct 02 15:48:57 v2202207179944196310 nginx[28113]: nginx: configuration file /etc/nginx/nginx.conf test failed
Here's a quick solution:
Edit /etc/nginx/nginx.conf (dont forget to backup it) to add or modify server_names_hash_bucket_size
to increase the value in the http
block:
http {
...
...
server_names_hash_bucket_size 64;
...
}
Test the config and restart service:
sudo nginx -t
sudo systemctl restart nginx
That solves the issue by allowing Nginx to handle more server blocks.