Config apache » Historie » Version 1
Jeremias Keihsler, 13.01.2017 12:17
1 | 1 | Jeremias Keihsler | h1. Apache config |
---|---|---|---|
2 | |||
3 | h2. VirtualHost |
||
4 | |||
5 | h3. Redirect external request to internal server |
||
6 | |||
7 | this is taken from http://stuf.ro/internal-redirect-to-external-url-in-apache/ |
||
8 | |||
9 | If you have the following scenario: |
||
10 | * one external IP |
||
11 | * only one Apache server responding to that external IP |
||
12 | * a separate site on a separate internal server |
||
13 | In this case, you can create a new site on the public Apache server that will redirect everything to the separate internal server. |
||
14 | |||
15 | 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. |
||
16 | |||
17 | 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. |
||
18 | |||
19 | <pre><code class="xml"> |
||
20 | <VirtualHost *:80> |
||
21 | ServerName example.com |
||
22 | ServerAlias www.example.com |
||
23 | ProxyRequests Off |
||
24 | <Proxy *> |
||
25 | Order deny,allow |
||
26 | Allow from all |
||
27 | </Proxy> |
||
28 | ProxyPass / http://192.168.0.123/ |
||
29 | </VirtualHost> |
||
30 | </code></pre> |