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.
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 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
- In
http {}:server_names_hash_bucket_size 128; - Increase
server_names_hash_max_sizefor many names - Reload after
nginx -t
Detailed fix by platform
Nginx
http { server_names_hash_bucket_size 128; }
How to diagnose
- Names — Long/many?
- Bucket — Current value?
- 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:
Similar errors
- 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: [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: conflicting server name ignored Nginx: nginx: [warn] conflicting server name "example.com" on 0.0.0.0:80, ignored
Most viewed in Nginx / Apache
- nginx: [emerg] unknown directive Nginx: nginx: [emerg] unknown directive "x" in /etc/nginx/sites-enabled/x:12 — configuration file test failed
- upstream timed out Nginx: upstream timed out (110: Connection timed out) while reading response header from upstream
- AH00558 Apache: AH00558: apache2: Could not reliably determine the server's fully qualified domain name
Other ways to find it
Where this error sits
Origin: Edge & web server. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Report a correction or suggest an improvement
Last updated 5 Nov 2026