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

Posted May 13, 2021 1.2k views
Server OptimizationDockerDNSCloud Computing

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

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.

Submit an Answer
1 answer

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:

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


by Mitchell Anicas
This articles covers how to install Nginx, a web server, on a CentOS 7 virtual server. This can be done with the CentOS package installer, yum.