Multiple domain on the same host with nginx


I have 2 different domains (say A and B) both mapping to the same IP via proxy on cloudflare.
When I enable proxy both A and B point to A. I am using nginx to setup the domains.

When I disable proxy on B then B works.

How do I make them work with a proxy?

It seems extremely strange, I believe there is a misconfiguration on the server where on a specific port you are serving only one. Check that.

I tried with apache2 as well. I see the same behavior.
I doubt if it’s a misconfiguration on the server.

But as soon as I disable the proxy (and switch to DNS the A record) it’s no longer a problem without modifying the server config.

But are you connecting to the same port? Have you tried both ports (80 and 443) without the proxy?

I found a solution. I had to make entries in /etc/hosts

ip A
ip B

That fixed it

This topic was automatically closed after 14 days. New replies are no longer allowed.