|
|
| Zeile 1: |
Zeile 1: |
| '''Apache/HTTP/Reverse proxy''' - Apache-[[Reverse-Proxy]]
| |
|
| |
|
| == Beschreibung ==
| |
| ; HTTP(S)-Anforderungen an andere Computer weiterleiten
| |
| Apache kann als [[Reverse-Proxy]] verwendet werden
| |
|
| |
| ; Vorteile
| |
| {| class="wikitable options big"
| |
| |-
| |
| | Sicherheit || Apache-Instanz kann in eine DMZ gestellt und der Welt ausgesetzt werden, während die Webserver ohne Zugriff auf die Außenwelt dahinter sitzen können
| |
| |-
| |
| | Last reduzieren || Sie können die Last auf den Webservern mit verschiedenen Methoden reduzieren, z. B. Web-Caching am Proxy, Lastausgleich und Ablenkung des Datenverkehrs für ungültige Anforderungen
| |
| |}
| |
|
| |
| == mod_proxy ==
| |
| [[mod_proxy]]
| |
|
| |
| == Konfiguration ==
| |
| Sobald diese Module aktiviert sind, können wir mit der Bearbeitung der Apache-Konfiguration beginnen
| |
| * Die Speicherorte variieren je nach Distribution
| |
| * Bei RHEL-basierten Distributionen ist dies Ihre httpd.conf
| |
| * Für Debian-basierte Sites verfügbar / Standard
| |
|
| |
| === VirtualHost ===
| |
| Erstellen Sie in Ihrem VirtualHost-Tag ein Location-Tag das dem externen Pfad entspricht, den Sie verwenden möchten
| |
|
| |
| Beispiel /
| |
| <syntaxhighlight lang="apache" line>
| |
| <Location />
| |
| # commands go here
| |
| </Location>
| |
| </syntaxhighlight>
| |
|
| |
| ; Location
| |
| Hinzufügen
| |
| * ProxyPass
| |
| * ProxyPassReverse
| |
| gefolgt von der Site-Adresse, die das Ziel des Proxys sein wird
| |
|
| |
| ; Zugriff ermöglichen
| |
| <syntaxhighlight lang="apache" line>
| |
| ProxyPass http://mywebsite.foxtom.net/
| |
| ProxyPassReverse http://mywebsite.foxtom.net/
| |
| Order allow,deny
| |
| Allow from all
| |
| </syntaxhighlight>
| |
|
| |
| ; Extras
| |
| Fügen Sie außerhalb der location-Standort-Tags oben auf dem virtuellen Host einige Extras hinzu
| |
| <syntaxhighlight lang="apache" line>
| |
| ProxyHTMLStripComments on
| |
| ProxyRequests off
| |
| SetOutputFilter proxy-html
| |
| ProxyHTMLDoctype XHTML
| |
| </syntaxhighlight>
| |
|
| |
| ; SSL-Datenverkehr
| |
| SSL-Datenverkehr als Proxy verwenden
| |
| <syntaxhighlight lang="apache" line>
| |
| SSLProxyEngine on
| |
| </syntaxhighlight>
| |
|
| |
| ; Starten Sie Apache neu
| |
| Starten Sie Apache neu oder laden Sie die Einstellungen neu, damit die Änderungen wirksam werden
| |
| <syntaxhighlight lang="bash" highlight="1" line>
| |
| sudo systemctl restart apache2 reload
| |
| </syntaxhighlight>
| |
|
| |
| === Beispiel ===
| |
| ; Apache Reverse Proxy VirtualHost
| |
| VirtualHost, der Port 80 überwacht
| |
| * Akzeptiert Anforderungen, die mit '''www.foxtom.net''' übereinstimmen
| |
| * leitet Anforderungen an '''website.foxtom.net''' weiter
| |
|
| |
| <syntaxhighlight lang="apache" line>
| |
| <VirtualHost *:80>
| |
| ServerAdmin administrator@foxtom.net
| |
| ProxyRequests off
| |
| DocumentRoot /var/www
| |
| SSLProxyEngine on
| |
| ProxyPreserveHost On
| |
|
| |
| ServerName www.foxtom.net
| |
|
| |
| ErrorLog ${APACHE_LOG_DIR}/error.log
| |
| CustomLog ${APACHE_LOG_DIR}/access.log combined
| |
|
| |
| # Possible values include: debug, info, notice, warn, error, crit,
| |
| # alert, emerg
| |
| LogLevel error
| |
|
| |
| <Location />
| |
| ProxyPass http://mywebsite.foxtom.net/
| |
| ProxyPassReverse http://mywebsite.foxtom.net/
| |
| Order allow,deny
| |
| Allow from all
| |
| </Location>
| |
|
| |
| </VirtualHost>
| |
| </syntaxhighlight>
| |
|
| |
|
| |
| <noinclude>
| |
|
| |
| == Anhang ==
| |
| === Siehe auch ===
| |
| {{Special:PrefixIndex/{{BASEPAGENAME}}/}}
| |
| * [[Reverse proxy]]
| |
|
| |
| === Dokumentation ===
| |
| === Links ===
| |
| ==== Weblinks ====
| |
|
| |
| [[Kategorie:Apache/HTTP/Proxy/Reverse]]
| |
|
| |
| </noinclude>
| |