VPS Tutorials
How to Fix the Nginx “conflicting server name” Warning
Find duplicate server names on your VPS, fix the right virtual host, and check which page and HTTPS certificate Nginx serves.

If Nginx prints conflicting server name "app.example.com" on 0.0.0.0:80, ignored, copy the hostname and the address and port from the end of the warning. Nginx loaded two declarations for that name on the same listener. It keeps the first one. The configuration test can pass while requests still reach the old site.
Use nginx -T to find both declarations. Give the hostname to the intended virtual host, then test the origin with curl --resolve to see which page and certificate it actually serves.
Nginx narrows the choice to the IP address and port that received the connection, then matches the hostname in that group. An exact name takes precedence over a wildcard. If no name matches, the default server for that address and port handles the request. Nginx request processing · Server name matching
| What you see | Where to look |
|---|---|
The warning names 0.0.0.0:80 and HTTP serves the old site | Find both declarations on the IPv4 HTTP listener |
The warning names [::]:443 and only some visitors see the wrong site | Check the IPv6 HTTPS blocks and the domain's AAAA record |
| Your browser gets a certificate for another hostname | Test the affected hostname against the HTTPS listener |
| One block uses the name on 80 and another uses it on 443 | This is valid, for example when HTTP redirects to HTTPS |
A VPS can use one port for several websites. The warning identifies a collision of the listener address, port, and name together.
Run this on the VPS that hosts the Nginx instance. If its service starts Nginx with -c, use that same configuration path when dumping and testing it.
sudo nginx -T 2>&1 | awk '
/^# configuration file / { file=$0 }
/conflicting server name|\[emerg\]/ { print }
/^[[:space:]]*(listen|server_name)[[:space:]]/ {
print file
print " " $0
}
'
The dump shows the configuration on disk. Open the files listed for the hostname and read both complete server blocks. A block can have multiple listeners, and names can span several lines. Look for an old symlink in sites-enabled or a backup ending in .conf that still matches include conf.d/*.conf. The active configuration's include directives determine which files Nginx loads. Nginx command-line reference
These two blocks both claim the app hostname on port 80. If Nginx loads the legacy file first, a request for the app gets the legacy site response.
# 00-legacy.conf
server {
listen 80;
server_name legacy.example.net app.example.com;
return 200 "legacy site\n";
}
# 10-app.conf
server {
listen 80;
server_name app.example.com;
return 200 "app site\n";
}
To move the app hostname, change the old declaration to server_name legacy.example.net;. The legacy site keeps its own name. If the entire old file belongs to a retired site, back it up outside all included paths and disable it in the same way you manage other sites. For a vhost generated by a hosting panel, change the panel entry or its template so the fix survives regeneration.
Check the HTTPS blocks on the corresponding listener as well. Preserve the correct certificate, key and location directives for the app. Keep the HTTP redirect block where the site needs one. The default_server setting controls where unmatched requests go.
sudo nginx -t
Read the output and confirm the affected warning is gone. A zero exit status can accompany a warning. Use the following reload command when the VPS runs Nginx as a systemd service. For a container or a hosting panel, use its reload entry point.
sudo systemctl reload nginx
If reload fails, read the service logs. Correct or restore the files you changed, test again, and retry. Confirm the running instance serves the expected site after the change. How nginx reloads its configuration
Replace the hostname, documentation IP, and path with yours. Run these from a network location that can reach the origin. The URL retains the hostname for the HTTP request and, on HTTPS, for SNI and certificate validation. curl --resolve reference · Nginx virtual server selection
curl -sS -i --max-time 10 --noproxy app.example.com \
--resolve app.example.com:80:203.0.113.10 http://app.example.com/
curl -sS -i --max-time 10 --noproxy app.example.com \
--resolve app.example.com:443:203.0.113.10 https://app.example.com/
On HTTP, check the status and Location if that path should redirect. On HTTPS, check that verification passes and that the body belongs to the right site. If your origin uses a private CA, supply its trusted CA file with --cacert. Repeat the checks for any hostname left on the old block. Then try the same path through your usual public URL. A difference at that point is a reason to inspect the A and AAAA records and the CDN's origin settings.
A standalone Nginx 1.19.6 instance on macOS listened on two temporary loopback ports, one for HTTP and one for HTTPS. The test used a certificate for each hostname, nginx -T to read the configuration, and curl --resolve with the test certificates trusted explicitly.
| Check | Before the change | After the change |
|---|---|---|
| Configuration test | Exit 0, duplicate-name warning on both listeners | Exit 0, both warnings cleared |
| App over HTTP | legacy site | app site |
| App over HTTPS | Legacy certificate, curl exit 60 on hostname mismatch | App certificate, app site |
| Legacy hostname | Its name still appeared in the legacy block | Both HTTP and HTTPS returned legacy site on retest |
The fix removed the app name from the old blocks and reloaded Nginx. Test both hostnames after a production change, especially if the old block had a list of aliases.
- If Nginx prints
bind() failed, identify the process that has the port. - If the right hostname redirects repeatedly, trace redirects through Nginx and Cloudflare.
- If HTTPS still stops at the CDN, check Cloudflare 525 and 526 and the origin certificate.
Next step: compare the actual plans
Filter the listed plans by budget, specifications and region, or start with a buying guide.