Question

[Beginner] Subdomain Setup to specific IP:port (sneaky configuration)

Hello everyone! I’m looking forward to receiving support and help from the community! Here’s the challenge!

#Beginner:

To kick it off, I am an extreme beginner at this. so, the more detailed/step-by-step answer you can provide the better for me and any other beginner seeking a similar solution.

#Context: There are three variables for the current issue:

  • I have a domain name registered in a place
  • The root/main domain (naggiar.net) is routed to a hosting server outside Digital OCean
  • However, a developer has created a web app (REACT/NodeJS) and we installed it on Digital ocean on the following IP: http://68.183.218.18:5001

#What’s needed:

#Here is what we’ve done so far:

  • Created a subdomain shop.naggiar.net
  • Created an A record to point to the IP 68.183.218.18

#How can you help?

  • What is/are the next step(s) that we need to do?
  • on which server should they need to be done?

Looking forward to your support and help! Thanks,


Submit an answer


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!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
February 20, 2021
Accepted Answer

Hi there,

Welcome the DigitalOcean community!

What I could suggest in this case is:

  • As you mentioned add an A record for your subdomain name to point the Droplet’s IP address. After that note that it could take up to a 24/48 hours for the DNS cache to clear over the Globe before you could see the new recrod

  • Then on your server, I would recommend using Nginx as a reverse proxy, so that when you visit your subdomain name in your browser, you don’t have to type the port after that.

To install Nginx you can follow the steps here:

https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-20-04

After that you can use the following configuration:

server {
    listen 80;
    server_name your_domain.com;
    root /var/www/html;

    index index.html index.htm index.php;

<^>    location / {
        proxy_pass http://localhost:5001;
        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;
    }<^>

}

For more details on how to setup NodeJS for production, I would recommend this tutorial here:

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04

Regards, Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel