Apache remap to apache within docker container
I am currently having an apache server running several virtual hosts.
However I want to use another apache setup on one virtual host. My idea is to install apache with different settings inside a docker container. But then how would I set it up?
If I have an apache inside a docker container it would have to listen to another port, right? And the apache outside of docker would have to somehow redirect traffic to apache inside of docker?
Currently my config looks like this:
Say I want host2.com to be handled inside the apache inside of docker.
I “guess” I could do a redirect in the apache outside of docker with:
RedirectMatch ^(.*)$ http://host2.com:81$1
and then have this inside of the apache inside docker:
But I would like the redirect/rewrite/remapping to be internal so that the client could not see any change. Is this possible?
Could you use a thin layer to proxy to each specific container (your host1 and host2)? For this, you could use Nginx, Hipache, or some other proxy to send traffic to your two different sites contained in different docker containers.
In this example, you’d have three containers. One that accepts and proxies traffic to the two other containers. I’ve made up some external ports just for the sake of the example below.
Nginx (or other) Reverse Proxy Container : Internal port 80, External port 80
- host1.com -> 49000
- host2.com -> 49001
Docker Apache Container 1: Internal port 80, External port 49000
Docker Apache Container 2: Internal port 80, External port 49001