I am running two node apps on one droplet, and using nginx. Yesterday I was setting two domains leading to two different ports on my droplet web server: www.domain.com - > http://localhost:9001 sub.domain.com - > http://localhost:9002
This is what I have done on nginx/sites-available/default to make it happen:
server { listen 80;
server_name domain.com www.domain.com;
location / {
proxy_pass http://localhost:9001;
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;
}
}
server { listen 80;
server_name sub.domain.com;
location / {
proxy_pass http://localhost:9003;
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;
}
}
It was working perfectly, but now I see that the nginx make the proxy pass only for the main domain, while it does nothing to the sub domain. (yes, both ports are working when accessing m.y.i.p:9002)
Also, I am getting this error on the Digital Ocean DNS log: dns_master_load: /dev/shm/bind/DO/db.grmmph.com:15: *.grmmph.com: CNAME and other data zone grmmph.com/IN: loading from master file /dev/shm/bind/DO/db.grmmph.com failed: CNAME and other data zone grmmph.com/IN: not loaded due to errors.
Any help? Please?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
hey, I got the same problem as you mentioned at last, would you please tell me how to solve it? thanx!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.