Question

How to Host Multiple Docker Containers on a Single Server with Nginx Reverse Proxy?

At the urging of the video creator, I am posting this question mainly for educational purposes.

I followed the instructions in the video and managed to have a working proxy server just like video ones. Issues start when I decided to set up the same proxy server on a Linux distribution other than Ubuntu. I tried it in Arch, open suse, centos and red hat. Although everything was done correctly, such as installing programs, setting up applications and configurations, the proxy failed to serve the containers but served the nginx default page.

A little background.

  1. The domain names are not stated by a DNS host but /etc/host was used as a DNS server.
  2. Containers possible to reached with ip and port number but not with server name.
  3. Above tried both in cloud servers and local VM engines with same results (only Ubuntu success.)

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.

Hi there,

What is the exact error that you get when you try to run this on another distribution?

What you would need to do is:

  • First install Nginx, you can do that by following the steps here:

https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-centos-7

  • Then add the Nginx server blocks at /etc/nginx/conf.d rather than sites-avaialbe

The rest of the video should work as expected. Feel free to share the exact error that you are getting here if it still does not work.

Regards, Bobby