Question

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

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?


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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

@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.

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