Question

How to config nginx for multiple nodejs apps?

  • Posted November 30, 2019
  • Nginx

i just config nginx like this

  server {
    listen 80;
    server_name mydomain.com www.mydomain.com;
    location / {
      proxy_pass http://167.172.192.169:7000;
      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 app.mydomain.com;
  location / {
    proxy_pass http://167.172.192.169:38453;
    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;
  }
}

i want sudomain app run in other node app but i still get stuck here, did i need config and DNS ??? pls help

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

Yes indeed you are correct, you would still need to set up an A record for your subdomain name to point to your droplet’s IP address.

If you are using DigitalOcean’s Nameservers, you could take a look at this tutorial on how to setup DNS records:

https://www.digitalocean.com/docs/networking/dns/how-to/manage-records/

Once you make the change, it can take up to 48 hours for the DNS cache to clear over the Globe before you could see the changes.

Regards, Bobby