I'm new to server stuff and started learning nginx, so any help is greatly appreciated.
I have 3 domains from cpanel with the same IP address namely extra1.example.com, backend1.example.com and backend2.example.com
this is my nginx config
upstream backends {
server backend1.example.com:443;
server backend2.example.com:443;
}
server {
server_name main.example.com;
location / {
proxy_pass https://backends;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection '';
proxy_cache_bypass $http_upgrade;
// SSL settings here
}
}
And I run nginx -t and it's fine. Now the problem is whenever browse the site https://main.example.com it displays the content of extra1.example.com. Is there something wrong I've done here? I've googling everything but I can't find the answer. Please help. Thank you
P.S. the loading balancer domain is from different hosting provider.
nginx -T
.