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

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>?

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.

DigitalOcean Employee
DigitalOcean Employee badge
September 30, 2020
Accepted 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.

Try DigitalOcean for free

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

Sign up

Featured on Community

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