I'm using a default EC2 instance with no domain name registered. I'm attempting to test some multi-tenant functionality in a MEAN stack app using subdomains.
Basically I can access the site through the browser using a default AWS public DNS ex.
http://ec2-xx-xx-xx-xx.us-west-2.compute.amazonaws.com
That's all good and fine, it works OK.
The problem is that I want to enable the ability to access subdomains of that domain. So for example I want to be able to hit:
http://client1.ec2-xx-xx-xx-xx.us-west-2.compute.amazonaws.com
http://client2.ec2-xx-xx-xx-xx.us-west-2.compute.amazonaws.com
etc.
I can't figure out how to do this using nginx. Here's my current nginx default file:
server {
listen 80;
server_name *.ec2-xx-xx-xx-xx.us-west-2.compute.amazonaws.com;
location / {
proxy_pass http://127.0.0.1:8080/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
However when I navigate to any subdomain I get an error saying the webpage is not available.
If I access it without a subdomain the page loads just fine.
Any ideas on how I can get this to work?
Appreciate any help!
EDIT: You will notice that I've created a proxy pass because I have my node server running using forever on port 8080.