debian:proxy-server-debian:reverseproxy-debian

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
debian:proxy-server-debian:reverseproxy-debian [2017/10/27 16:28] michaeldebian:proxy-server-debian:reverseproxy-debian [2017/10/27 17:05] (current) – [Bereinigen der Virtual-Hosts] michael
Line 1: Line 1:
 ====== Reverse Proxy Installation auf Debian / Ubuntu ====== ====== Reverse Proxy Installation auf Debian / Ubuntu ======
-Als Grundlage für den Reverse Proxy wurde ein **Ubuntu 16.04** aufgesetzt. Im folgenden werden alle Schritte nach der fertigen OS Installation zum einrichten des Proxys beschrieben.+Als Grundlage für den hier zu installierenden Reverse Proxy wurde ein **Ubuntu 16.04** aufgesetzt. Im folgenden werden alle Schritte nach der fertigen OS Installation zum einrichten des Proxys beschrieben.
  
 **Was ist ein Reverse Proxy?** //Grundsätzlich handelt es sich bei einem Proxy um eine Kommunikationsschnittstelle im Netzwerk, die Anfragen entgegennimmt und stellvertretend an einen Zielrechner weiterleitet. Ein Reverse Proxy wird nun aber meistens als zusätzliche Sicherheitskomponente vor einen oder mehrere Webserver geschaltet, um Anfragen aus dem Internet stellvertretend entgegen-zunehmen und an einen Backend-Server im Hintergrund weiterzuleiten. **Was ist ein Reverse Proxy?** //Grundsätzlich handelt es sich bei einem Proxy um eine Kommunikationsschnittstelle im Netzwerk, die Anfragen entgegennimmt und stellvertretend an einen Zielrechner weiterleitet. Ein Reverse Proxy wird nun aber meistens als zusätzliche Sicherheitskomponente vor einen oder mehrere Webserver geschaltet, um Anfragen aus dem Internet stellvertretend entgegen-zunehmen und an einen Backend-Server im Hintergrund weiterzuleiten.
Line 11: Line 11:
 </WRAP> </WRAP>
  
-**[[http://www.fit-pc.com/web/products/ipc3/|Weitere interessante Hardware für standalone Proxies (Falls kein Odroid gebraucht wird)]]**+**[[http://www.fit-pc.com/web/products/ipc3/|Interessante Hardware für standalone Proxies]]**
  
 ---- ----
Line 47: Line 47:
 ---- ----
  
 +
 +<WRAP center box 100%>
 ===== Installation der Grundkomponenten ===== ===== Installation der Grundkomponenten =====
 Zu Beginn werden erst einmal alle Grundpakete, welche zum einrichten unseres Proxys gebraut werden installiert. <wrap em>ACHTUNG: Das Paket "''<wrap em>libapache2-mod-proxy-html</wrap>''" ist bei ''<wrap em>Ubuntu 16.04</wrap>'' schon in der Base Installation enthalten!</wrap> Zu Beginn werden erst einmal alle Grundpakete, welche zum einrichten unseres Proxys gebraut werden installiert. <wrap em>ACHTUNG: Das Paket "''<wrap em>libapache2-mod-proxy-html</wrap>''" ist bei ''<wrap em>Ubuntu 16.04</wrap>'' schon in der Base Installation enthalten!</wrap>
Line 73: Line 75:
 # git clone https://github.com/letsencrypt/letsencrypt # git clone https://github.com/letsencrypt/letsencrypt
 </code> </code>
 +
 +</WRAP>
  
 ---- ----
Line 97: Line 101:
 ''<wrap em>ACHTUNG: Folgene Virtual-Host sind reine Beispiele und müssen dementsprechend noch durch richtige Domainnamen ergänzt, abgeändert werden.</wrap>'' ''<wrap em>ACHTUNG: Folgene Virtual-Host sind reine Beispiele und müssen dementsprechend noch durch richtige Domainnamen ergänzt, abgeändert werden.</wrap>''
  
-//Alle anzupassenden Zeilen sind Blau markiert! PS: EXAMPLE.COM wird durch eigenen Domain-namen ersetzt!//+''//Alle anzupassenden Zeilen sind Blau markiert! PS: EXAMPLE.COM wird durch eigenen Domain-namen ersetzt!//''
  
 ---- ----
Line 107: Line 111:
 </code> </code>
  
-<sxh bash; first-line: 1>+<sxh bash; first-line: 1; highlight: [5]>
 <VirtualHost *:80> <VirtualHost *:80>
 # ServerName example.com # ServerName example.com
 ServerName localhost ServerName localhost
  #  #
-   ServerAdmin admin-mail@example.com+   ServerAdmin admin@example.com
    DocumentRoot /var/www/html    DocumentRoot /var/www/html
  #  #
Line 126: Line 130:
 </code> </code>
  
-<sxh bash; first-line: 1>+<sxh bash; first-line: 1; highlight: [5,7,16,18-26]>
 #------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------
 #                             REDIRECTION FOR NON EXISTENT SUBDOMAINS #                             REDIRECTION FOR NON EXISTENT SUBDOMAINS
Line 144: Line 148:
  ServerName example.com  ServerName example.com
  #  #
-     ServerAdmin michael.r467@gmail.com+     ServerAdmin admin@example.com
  
      ServerAlias www.example.com      ServerAlias www.example.com
Line 168: Line 172:
 </code> </code>
  
-<sxh bash; first-line: 1>+<sxh bash; first-line: 1; highlight: [6,7,12,27,38-39,41,48,56-57,61,68,81-82,84,91,102-103,106,112,120-121,123,133,142]>
 <IfModule mod_ssl.c> <IfModule mod_ssl.c>
 +  
 +#------------------------------------------------------------------------------------------------ 
 +#                                VARIABLES and GENERAL SETTINGS 
 +#------------------------------------------------------------------------------------------------ 
 +define blackgate_serveradmin "admin@example.com" 
 +define blackgate_ssl_path "/etc/letsencrypt/live/blackgate.org-0001" 
 +  
 +SSLCompression off 
 +SSLUseStapling on 
 +SSLStaplingCache "shmcb:logs/stapling-cache(150000)" 
 +SSLOpenSSLConfCmd DHParameters "/etc/ssl/private/dhparam.pem" 
 +  
 +# Requires Apache >= 2.4.11 
 +SSLSessionTickets Off 
 +  
 +#SSLCipherSuite "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH" 
 +SSLCipherSuite "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH" 
 +SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 
 +Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains; preload" 
 + 
 #------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------
 #                                       MAIN SERVICES #                                       MAIN SERVICES
 #------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------
- +  
 +<VirtualHost *:443> 
 + ServerName www.example.com 
 + # 
 +     ServerAdmin ${blackgate_serveradmin} 
 +     SSLEngine on 
 +     SSLCertificateFile ${blackgate_ssl_path}/cert.pem 
 +     SSLCertificateKeyFile ${blackgate_ssl_path}/privkey.pem 
 +     SSLCertificateChainFile ${blackgate_ssl_path}/chain.pem 
 +  
 +     ProxyPass /error_docs ! 
 +     ErrorDocument 503 /error_docs/ServiceUnavailable.html 
 +   
 +     ProxyPass      / http://192.168.1.21/ 
 +     ProxyPassReverse   / http://192.168.1.21/ 
 +  
 +     <Proxy http://192.168.1.21/> 
 +             Order deny,allow 
 +             Allow from all 
 +     </Proxy> 
 +</VirtualHost> 
 +  
 +<VirtualHost *:443> 
 + ServerName piwik.example.com 
 + # 
 +     ServerAdmin ${blackgate_serveradmin} 
 +     SSLEngine on 
 +     SSLCertificateFile ${blackgate_ssl_path}/cert.pem 
 +     SSLCertificateKeyFile ${blackgate_ssl_path}/privkey.pem 
 +     SSLCertificateChainFile ${blackgate_ssl_path}/chain.pem 
 +      
 +     ProxyPass / http://192.168.1.11:8080/ 
 +     ProxyPassReverse / http://192.168.1.11:8080/ 
 +      
 +     ProxyPreserveHost On 
 +      
 +     <Proxy http://192.168.1.11:8080/> 
 +             Order deny,allow 
 +             Allow from all 
 +     </Proxy> 
 +</VirtualHost> 
 +   
 +<VirtualHost *:443> 
 + ServerName cloud.example.com 
 + # 
 +     ServerAdmin ${blackgate_serveradmin} 
 +     SSLEngine on 
 +     SSLCertificateFile ${blackgate_ssl_path}/cert.pem 
 +     SSLCertificateKeyFile ${blackgate_ssl_path}/privkey.pem 
 +     SSLCertificateChainFile ${blackgate_ssl_path}/chain.pem 
 +       
 +     ProxyPreserveHost On 
 +  
 +     ProxyPass /error_docs ! 
 +     ErrorDocument 503 /error_docs/ServiceUnavailable.html 
 +  
 +     ProxyPass / http://192.168.1.24/ retry=1 acquire=3000 Timeout=5400 Keepalive=On flushpackets=On 
 +     ProxyPassReverse / http://192.168.1.24/ 
 +      
 +     <Proxy http://192.168.1.24/> 
 +             Order deny,allow 
 +             Allow from all 
 +     </Proxy> 
 +</VirtualHost> 
 +   
 +<VirtualHost *:443> 
 + ServerName wiki.example.com 
 + # 
 +     ServerAdmin ${blackgate_serveradmin} 
 +     SSLEngine on 
 +     SSLCertificateFile ${blackgate_ssl_path}/cert.pem 
 +     SSLCertificateKeyFile ${blackgate_ssl_path}/privkey.pem 
 +     SSLCertificateChainFile ${blackgate_ssl_path}/chain.pem 
 +  
 +     ProxyPass /error_docs ! 
 +     ErrorDocument 503 /error_docs/ServiceUnavailable.html 
 +  
 +     ProxyPass / http://192.168.1.10/ 
 +     ProxyPassReverse / http://192.168.1.10/ 
 +     ProxyPreserveHost On 
 +  
 +     <Proxy http://192.168.1.10/> 
 +          Require all granted 
 +     </Proxy> 
 +</VirtualHost> 
 +  
 +<VirtualHost *:443> 
 + ServerName test.example.com 
 + # 
 +     ServerAdmin ${blackgate_serveradmin} 
 +     SSLEngine on 
 +     SSLCertificateFile ${blackgate_ssl_path}/cert.pem 
 +     SSLCertificateKeyFile ${blackgate_ssl_path}/privkey.pem 
 +     SSLCertificateChainFile ${blackgate_ssl_path}/chain.pem 
 +  
 +     ProxyPass / http://192.168.1.15/ retry=1 acquire=3000 Timeout=7200 Keepalive=On flushpackets=On 
 +     ProxyPassReverse / http://192.168.1.15/ 
 +      
 +     <Proxy http://192.168.1.15/> 
 +             Order deny,allow 
 +             Allow from all 
 +     </Proxy> 
 +  
 +     #ProxyPassReverseCookiePath /guacamole / 
 +</VirtualHost> 
 +  
 +  
 +#<VirtualHost *:443> 
 +#     ServerAlias *.example.com 
 +#     SSLEngine on 
 +#     SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH 
 +#     SSLProtocol All -SSLv2 -SSLv3 
 +#     Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains; preload" 
 +#     SSLCertificateFile /etc/letsencrypt/live/blackgate.org/cert.pem 
 +#     SSLCertificateKeyFile /etc/letsencrypt/live/blackgate.org/privkey.pem 
 +#     SSLCertificateChainFile /etc/letsencrypt/live/blackgate.org/chain.pem 
 +#     RewriteEngine On 
 +#     Redirect 301 / https://www.example.com 
 +#</VirtualHost> 
 +  
 +  
 +</IfModule> 
 +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
  
 </sxh> </sxh>
Line 188: Line 332:
 </code> </code>
  
-<sxh bash; first-line: 1>+<sxh bash; first-line: 1; highlight: [2,4,6-12]>
  
 <VirtualHost *:80> <VirtualHost *:80>
- ServerName blackgate.org+ ServerName example.com
  #  #
-     ServerAdmin michael.r467@gmail.com+     ServerAdmin admin@example.com
  
-     ServerAlias www.blackgate.org +     ServerAlias www.example.com 
-     ServerAlias su-login.blackgate.org +      
-     ServerAlias serv.blackgate.org +     ServerAlias piwik.example.com 
-     ServerAlias piwik.blackgate.org+     ServerAlias cloud.example.com
  
-     ServerAlias plexpy.blackgate.org +     ServerAlias wiki.example.com 
-     ServerAlias plexdash.blackgate.org +     ServerAlias test.example.com
-     ServerAlias emby.blackgate.org +
-     ServerAlias stream.blackgate.org +
-     ServerAlias request.blackgate.org +
- +
-     ServerAlias cloud.blackgate.org +
-     ServerAlias office.blackgate.org      +
-     ServerAlias ucloud.blackgate.org +
- +
-     ServerAlias wiki.blackgate.org +
-     ServerAlias index.blackgate.org +
-     ServerAlias xxx.blackgate.org +
-     ServerAlias test.blackgate.org+
            
    DocumentRoot /var/www/html    DocumentRoot /var/www/html
Line 245: Line 377:
  
 <code> <code>
-# ./letsencrypt-auto certonly --rsa-key-size 4096 -d blackgate.org -d xxx.blackgate.org -d cloud.blackgate.org -d su-login.blackgate.org -d plexpy.blackgate.org -d wiki.blackgate.org -d serv.blackgate.org -d www.blackgate.org -d stream.blackgate.org -d emby.blackgate.org -d request.blackgate.org -d index.blackgate.org -d ucloud.blackgate.org -d piwik.blackgate.org -d plexdash.blackgate.org -d test.blackgate.org+# ./letsencrypt-auto certonly --rsa-key-size 4096 -d example.com -d www.example.com -d piwik.example.com -d cloud.example.com -d wiki.example.com -d test.example.com
  
 </code> </code>
Line 289: Line 421:
 # a2dissite letsencript_dummy.conf # a2dissite letsencript_dummy.conf
  
-# a2ensite blackgate.org.conf+# a2ensite EXAMPLE.COM.conf
 # a2ensite proxy_http.conf # a2ensite proxy_http.conf
-# a2ensite proxy_https_blackgate.conf+# a2ensite proxy_https.conf
  
 </code> </code>
Line 391: Line 523:
   - Zum letsencript Binary wechseln und den letzten certonly Befehl //(Suchen mit CTRL + R)// mit der am Schluss neu angehängter Domain z.B. "**-d NEU-SUBDOM.DOMAIN.COM**" ausführen. <code>   - Zum letsencript Binary wechseln und den letzten certonly Befehl //(Suchen mit CTRL + R)// mit der am Schluss neu angehängter Domain z.B. "**-d NEU-SUBDOM.DOMAIN.COM**" ausführen. <code>
 # cd /opt/letsencrypt/ # cd /opt/letsencrypt/
-# ./letsencrypt-auto certonly --rsa-key-size 4096 -d blackgate.org -d xxx.blackgate.org -d cloud.blackgate.org -d su-login.blackgate.org -d plexpy.blackgate.org -d wiki.blackgate.org -d serv.blackgate.org -d www.blackgate.org -d stream.blackgate.org -d emby.blackgate.org -d request.blackgate.org -d index.blackgate.org -d ucloud.blackgate.org -d proxy.blackgate.org -d plexdash.blackgate.org -d test.blackgate.org -d piwik.blackgate.org+# ./letsencrypt-auto certonly --rsa-key-size 4096 -d example.com -d www.example.com -d piwik.example.com -d cloud.example.com -d wiki.example.com -d test.example.com -d new1.example.com -d new2.example.com
 </code> </code>
   - Zum Schluss muss noch der Apache Service neu geladen werden, damit das neue Zertifikat angezogen wird. <code>   - Zum Schluss muss noch der Apache Service neu geladen werden, damit das neue Zertifikat angezogen wird. <code>
  • debian/proxy-server-debian/reverseproxy-debian.1509114495.txt.gz
  • Last modified: 2017/10/27 16:28
  • by michael