Question

Docker droplet image from market place - do I need nginx to resolve domain name to docker site?

So I have created a droplet from the docker image on marketplace and have my site docker instance cloned, built and up.

In order for my domain (sub domains) to point a specific service on my docker instance, do I ‘need’ to use nginx?

Assuming I do; does anybody know a decent (up to date) tutorial to show me how to achieve this, please? I have a production and a sandbox subdomain that needs to point to relevant services on my docker instance (already pointing to DO nameservers).

I also now have an nginx docker instance setup and running.

From this point I have found several ways to use nginx to point each subdomain to the relevant port number on a docker instance (using port 8017 and 9017, respectively), but am confused by the number of options/choices to achieve this goal!

I am most likely over thinking it, but any pointers would be greatly appreciated.

k…


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.

Bobby Iliev
Site Moderator
Site Moderator badge
January 5, 2023

Hi there,

Indeed you can use Nginx as a reverse proxy. Here is a quick tutorial on how to set that up:

https://www.digitalocean.com/community/questions/how-to-host-multiple-docker-containers-on-a-single-droplet-with-nginx-reverse-proxy

Keep in mind that the exact Nginx rules that you would need to use in your Nginx config file would depend on the framework that you are using. Feel free to share more details about the Docker containers and the services that you are running inside them and I can give you more details on what rules you need to add to the Nginx server blocks.

Let me know how it goes!

Best,

Bobby

Try DigitalOcean for free

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

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
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