Nginx: nginx: [emerg] duplicate location "/" in /etc/nginx/sites-enabled/default:52
Two location blocks with the same match exist in one server block (often from two included files).
nginx: [emerg] duplicate location "/" in /etc/nginx/sites-enabled/default[emerg] duplicate locationduplicate location "/" in[emerg] duplicate "default_server" for "0.0.0.0:80"[emerg] a duplicate default server for 0.0.0.0:80 Meaning
Each exact location may appear once per server. The default site and your own file both define location /, or an included snippet repeats one. Remove/merge duplicates, or disable the default site (rm /etc/nginx/sites-enabled/default).
Common causes
- Same
locationdefined twice - Default site and custom site both enabled for the same server_name
- Included snippets duplicate locations
- Copy-paste of config
- Regex location repeated
⚡ Quick fix
- Remove or merge the duplicate
location - Disable unneeded default site
- Use
nginx -T | grep -n "location /"to find duplicates
Detailed fix by platform
Linux
sudo nginx -T 2>/dev/null | grep -n 'location /'
How to diagnose
- Location — Which pattern?
- Files — Which include?
- Default — Enabled?
🔧 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
- could not build the server_names_hash, you should increase server_names_hash_bucket_size Nginx: nginx: [emerg] could not build the server_names_hash, you should increase server_names_hash_bucket_size: 64
- 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
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