Nginx emerg error: could not build the server_names_hash

Written by - 0 comments

Published on - Listed in Linux Internet Unix Nginx

I saw a weird error today where nginx wouldn't start after setting up the vhost configuration:

nginx: [emerg] could not build the server_names_hash, you should increase server_names_hash_bucket_size: 64

The reason for this was a very long server_name in the vhost config:

 server_name ;

The defined server_name was so long, that the hash, generated by the sever_name string, was longer than 64. The current setup had a fixed limit of a hash bucket size of 64:

grep server_names_hash_bucket_size /etc/nginx/nginx.conf
  server_names_hash_bucket_size 64;

By increasing the value to 128, the config was correctly loaded and nginx started up.

grep server_names_hash_bucket_size /etc/nginx/nginx.conf
  server_names_hash_bucket_size 128;

nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Another solution would be to use a shorter server_name, of course.
That would make more sense, agreed. But leave it to the customer to come up with such great server names...

Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.

RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder