Projekt

Allgemein

Profil

Aktionen

Apache config

VirtualHost

Redirect external request to internal server

this is taken from http://stuf.ro/internal-redirect-to-external-url-in-apache/

If you have the following scenario:
  • one external IP
  • only one Apache server responding to that external IP
  • a separate site on a separate internal server
    In this case, you can create a new site on the public Apache server that will redirect everything to the separate internal server.

As an example, let’s say we have the domain example.com and we want every request that comes to example.com to go to our internal server at 192.168.0.123.

First, create a new site that will make the internal redirects. If you want to call this site “example“, you will usually need to create an /etc/apache2/sites-available/example file in which to write the configuration.

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyPass / http://192.168.0.123/
</VirtualHost>

Von Jeremias Keihsler vor fast 8 Jahren aktualisiert · 1 Revisionen