could not build the server_names_hash, you should increase server_names_hash_bucket_size Nginx / Apache Origin: Edge & web server OSI layer 7 · Application Last updated 5 Nov 2026

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

A very long server_name (or many names) doesn't fit the hash bucket.

Exact message you may see could not build the server_names_hash, you should increase server_names_hash_bucket_size: 64nginx: [emerg] could not build the server_names_hashincrease server_names_hash_bucket_sizecould not build the variables_hash, you should increase either variables_hash_max_size
Seen on: Nginx Linux

Meaning

Add server_names_hash_bucket_size 128; (or 64/256) to the http {} block; raise server_names_hash_max_size if you have thousands of names. Typical with long domain names or many virtual hosts on one server.

Common causes

  • Very long domain/server_name
  • Hundreds of server names
  • Default bucket size 32/64 too small
  • Wildcard/regex names
  • Generated vhosts

⚡ Quick fix

  1. In http {}: server_names_hash_bucket_size 128;
  2. Increase server_names_hash_max_size for many names
  3. Reload after nginx -t

Detailed fix by platform

Nginx

  1. http { server_names_hash_bucket_size 128; }

How to diagnose

  1. Names — Long/many?
  2. Bucket — Current value?
  3. Fix — Increase in http?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Edge & web server. Errors that are often confused with or caused by this one (click to open):

nginx: [emerg] open() failed (2: No such file or directory) — Nginx: nginx: [emerg] open() "/etc/nginx/snippets/fastcgi-php.conf" failed (2: No such file or directory) in /etc/nginx/sites-enabled/app:20 (Nginx / Apache)nginx: [emerg] open()…nginx: [emerg] unexpected end of file, expecting ";" or "}" — Nginx: nginx: [emerg] unexpected end of file, expecting ";" or "}" in /etc/nginx/conf.d/site.conf:42 (Nginx / Apache)nginx: [emerg] unexpe…nginx: conflicting server name ignored — Nginx: nginx: [warn] conflicting server name "example.com" on 0.0.0.0:80, ignored (Nginx / Apache)nginx: conflicting se…nginx: directive is not terminated by ";" — Nginx: nginx: [emerg] directive "proxy_pass" is not terminated by ";" in /etc/nginx/sites-enabled/app:15 (Nginx / Apache)nginx: directive is n…nginx: duplicate location — Nginx: nginx: [emerg] duplicate location "/" in /etc/nginx/sites-enabled/default:52 (Nginx / Apache)nginx: duplicate loca…no "ssl_certificate" is defined for the "listen ... ssl" directive — Nginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directive in /etc/nginx/sites-enabled/default:3 (SSL / TLS)no "ssl_certificate" …Welcome to nginx! shown instead of my site — Browser: Welcome to nginx! If you see this page, the nginx web server is successfully installed and working (Nginx / Apache)Welcome to nginx! sho…could not…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.