ar099968
ar099968

Reputation: 7577

Docker: Multiple container on port 80 without NGinx

I want to run multiple web server on the same VM. Each web server is dockerized.

Is it possible to run multiple dockerized web servers on port 80, with different domains, using docker functionalities?

I found many solution based on NGinx proxy like here , but I don't find any user defined network usage that solves this problem.

Is there any solution to this problem without running a reverse proxy?

Upvotes: 0

Views: 1395

Answers (3)

DevDio
DevDio

Reputation: 1584

First of all it is possible to run multiple domains on the same port, but the requirement is that:

  1. you host sites on the same web server (Apache HTTPD or Nginx)
  2. you are using virtual hosts

The one server can be containerized, if needed.

Here is the example of running two domains on exactly one Nginx web server.

So depending on your requirements, that can be solution.

Upvotes: 1

Andrew Graham-Yooll
Andrew Graham-Yooll

Reputation: 2258

As far as I am aware, no it can not work to have multiple containers listening on port 80 or the same port in general.

You could open up different ports on your VM and have the applications listening to each one of those ports specifically.

For instance you could have your first application listen to port 80. Then your second one on port 81, etc.

Upvotes: 2

Thilo
Thilo

Reputation: 262814

No.

There is only one "real" port 80 on the host server (for each network address), so you need something that listens there and forwards to the different backend servers.

This is not a docker-specific problem. You cannot run multiple (non-Docker) web servers (one for each domain) on a single port either.

That something does not have to be nginx.

Upvotes: 3

Related Questions