Create new record to IP:PORT/Page

January 9, 2017 1.2k views
Development Python

Hi!

I currently have an application running on dropletIP:port/appname. I can't figure out how to connect it to my domain such that I get appname.domain.com.

Can you please help me out?:)

2 Answers

First thing you need is domain. In your Domain DNS management or DigitalOcean DNS management (if you pointed domains NS to DO and added domain to CP) you need to create CNAME record with name appname pointing to @.

Now you'll be able to use appname.example.com but you still need to configure server for it. What you can do is to create a reverse proxy. This is done using Apache or Nginx Web server.

I would recommend you to go with Nginx. It's very easy to set up reverse proxy with it, and it's lightweight.
First you need to install it - How To Install Nginx on Ubuntu 16.04, will help you to do so.
Then, you need a server block for your subdomain. Follow Server Blocks tutorial to set up server block for appname.example.com.
Now you're ready for key part - reverse proxy. Nginx docs will help you set up it.

If you got any questions or need help, feel free to ask. =)

Nginx is one of the most popular web servers in the world and is responsible for hosting some of the largest and highest-traffic sites on the internet. It is more resource-friendly than Apache in most cases and can be used as a web server or a reverse proxy. In this guide,...

So I already had nginx installed through the tutorial I followed to upload my app.

Unfortunately in that tutorial we overwrote the nginx default file (I don't know why, I still have no idea what I'm doing haha). But now I'm getting into trouble when following along with the Server Blocks tutorial because my nginx default file is not the actual nginx default file anymore...

Have another answer? Share your knowledge.