Report this

What is the reason for this report?

How to point a subdomain to a specific IP with Apache?

Posted on February 7, 2017

Hello, I have a simple Bottle.py python app inside a docker container that exposes port 8081. If I visit my.droplet.ip:8081 the app shows up. Now, I want the app to be on sub.mydomain.tld. Please note that I am running Apache2 and mydomain.tld is not hosted on my droplet. How may I approach the problem?



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!

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.

You create an A-Record in your DNS panel that points to the desired IP address.

@abhisekdutta

What you need to do is setup proxying. This can be done with Apache using mod_proxy and there’s a guide for exactly that here at DigitalOcean.

https://www.digitalocean.com/community/tutorials/how-to-use-apache-as-a-reverse-proxy-with-mod_proxy-on-ubuntu-16-04

Without using a proxy, which internally accepts requests for domain.com or sub.domain.com and serves domain.com:2365 (or any application running on a port, just an example), you’d need to keep the ports in the URL’s.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.