Search code examples
apacheapache2virtualhostlxclxd

apache - how to redirect to another server


I have the following problem:

I have my HomeServer on IP 192.168.0.1, it's an exposed host, getting every access from outside.

On this Server I have running some lxc containerts, two of them have apache2, etc on it.

Now I want to access every server via a special URL, for example:

  • cloud.example.com -> going to the "cloud" container on IP 192.168.0.101
  • torrent.example.com -> going to the "torrent" container on IP 192.168.0.103
  • everything else should go the HomeServer on 192.168.0.1

I thought of it like this: everything should go to 192.168.0.1, there I would have some VirtualHosts looking for the URL and forwarding the traffic to the needed server or showing the "default" page of the HomeServer (192.168.0.1)

The thing is, I've searched for quite a while but can't find the stuff I need.

Someone an idea?

Thanks in advance


Solution

  • I am now using HAProxy and it's working perfectly.

    Send requests from outside to router -> router sends it to HAProxy container -> HAProxy sends it to the needed container