Jason's picture

I have 2 domain names.

Domain1 is on a virtual server with ip

Domain2 is on a virtual server with ip


Everything on Domain1 is working. port forwarding is sending all traffic to that site as intended.


I cant get the virtual hosts to work on domain1 that will send domain2 traffic to the other IP.

Any assistance please?

Jeremy Davis's picture

What you need is called "reverse proxy". Essentially a reverse proxy accepts incoming requests and forwards them to the appropriate server.

You could use a completely separate reverse proxy (on a separate VM), however it is possible to configure Apache to act as a webserver for one domain and act as a reverse proxy for one or more other domains.

TBH, I don't have any practical experience configuring Apache to run as a reverse proxy, so I'm not sure how much practical help I'll be. But at least armed with the knowledge of what it's called, you may have better luck finding the info you need?! Also it's probably worth knowing that the version of Apache in TurnKey v15.x is Apache 2.4.25.

As a bit of a headstart, I've compiled a few pages that I think might be useful. The Apache docs are probably requisite reading, although the DigitalOcean tutorial is probably more practically useful (it's for an older version of Debian than what v15.x is based on, but the instructions should work the same). Note though, that on TurnKey when running as root (which you do by default) sudo is not required (and actually isn't even installed). I've also included a link to a LeaseWeb tutorial as it looks like it contains some additional info which may be relevant and useful.

  • Apache docs: Reverse Proxy Guide
  • DigitalOcean: How To Use Apache as a Reverse Proxy with mod_proxy on Debian 8
  • Leaseweb: Tutorial: Apache 2.4 as reverse proxy
  • I hope that's helpful and useful. If you continue to have issues, please post back with some more details of what you've done and what you're experiencing. Also, once you get it working, please feel free to post back with the Apache config you ended up with as it may well be useful for others. Good luck!

    Sarah Franks's picture

    Creating virtual host configurations on your Apache server does not magically cause DNS entries to be created for those host names. You must have the names in DNS, resolving to your IP address, or nobody else will be able to see your web site. You can put entries in your hosts file for local testing, but that will work only from the machine with those hosts entries.

    Add new comment