Okay so I have rather an unusual issue in my Ubuntu VPS. Visiting one domain shows the static html page of another domain. Let's look at the congif.
Suppose I have a site with domain: site1.com. This domain has 2 apps running perfectly in subdomains: app1.site1.com and app2.site1.com. The homepage doesn't have any apps but a simple html page which says:
'Welcome to Site 1. This site is currently under maintenance!'.
That is running perfectly as I wanted but the issue arose after I pointed a fresh domain (let's call him site2.com) from Namecheap to my VPS. Now when I visit site2.com, I can see:
'Welcome to Site 1. This site is currently under maintenance!'.
That is some real vodoo magic right there.
Here's how site1 nginx config file looks like:
server {
root /var/www/html/site1.com;
index index.html index.htm index.nginx-debian.html;
server_name site1.com www.site1.com;
location / {
try_files $uri $uri/ =404;
}
}
server {
root /var/www/app1.site1.com;
index index.html index.htm index.nginx-debian.html;
server_name app1.site1.com;
location / {
#try_files $uri $uri/ =404;
proxy_pass http://localhost:4000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_cache_bypass $http_upgrade;
}
}
server {
root /var/www/app2.site1.com;
index index.html index.htm index.nginx-debian.html;
server_name app2.site1.com;
location / {
#try_files $uri $uri/ =404;
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_cache_bypass $http_upgrade;
}
}
The html file is in /var/www/html/site1.com/index.html
What could be the reason for the magic?
I have also tried by creating a new nginx file for the new domain and create a new server block and point to its own html file, but it just doesn't take show that html page but rather the site1 page.
It'd be really helpful if someone points me to the right direction.