Docker Community Forums

Share and learn in the Docker community.

Multiple webservers with docker / docker-compose

docker

(Raphaelcasimir) #1

Hello,
I have a problem to get multiple webservers running on my self-hosted server.
I have first a working architecture using docker-compose to run nextcloud, and I want to run a second webserver, on a different subdomain.

If I run a second reverse proxy of course it doesn’t allow me to bind the port 80 as it is already in use by the first one. If I try to put the webserver on the proxy-tier network (where the first reverse proxy is) in a docker-compose, it puts automatically a prefix in front of the network name (compose_folder_name_proxy-tier) so this doesn’t work either.

Do you have any idea on how I can achieve the multiple webservers without breaking my current working nextcloud architecture?

Here is an overview of the architecture, the red container is the one that I want to add. I know that the reverse proxy should be in front of everything, but in this case how can it work with containers in docker-compose ?

network_pb

Thanks in advance for your help.


(Werner Dijkerman) #2

Are you familiar with tools like Traefic (https://traefik.io/) and Kong (https://getkong.org/)? What you can do - I haven’t tested them lately so just giving an idea - is to add one of these tools and run them on port 80. Based on the vhost/url you can then either forward it to the new “nginx webserver” or to the “reverse-proxy”.

As you already said that you can’t run a 2nd container on port 80, then you have to add a sharing container, a container that is used by both servers.

Or, add a 2nd IP to the host and bind one container on ip 1, the 2nd container on the 2nd ip and both are able to run on port 80.

Good luck!