Pointing DNS record (A) to specific part of my Droplet

Posted September 30, 2020 504 views

I’m running a simple backend using Python (flask) and I have set up an api which returns something on my droplet. I can access it by: http://<droplet-ip>/<app_route>. This works great but for the sake of not just giving out my server’s ip directly to everyone I wanted to add my domain to it. I have set my domain’s DNS records to DigitalOcean a while ago (over a month ago) and now I want to use it.

I created an A record with and pointed it to my droplet. How do I make it so routes to the previously mentioned http://<droplet-ip>/<app_route>?

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.

Submit an Answer
1 answer


First off, grats on your app, droplet and domain :)

Secondly, after you create the DNS record and point it at your Droplet’s IP, you sometimes have to configure your web server software to handle “virtual hosts”.

Here’s an example with nginx:
How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu 16.04

This might be helpful too, if you do not have nginx currently in use (or another web server like apache):
How To Serve Flask Applications with Gunicorn and Nginx on Ubuntu 18.04

Hope this helps and good luck! Let us know if you have any more questions.

by Justin Ellingwood
When using the Nginx web server, server blocks (similar to the virtual hosts in Apache) can be used to encapsulate configuration details and host more than one domain off of a single server. In this guide, we'll discuss how to configure server blocks in Nginx on an Ubuntu 16.04 server.