Kapitel 09/Premium Rohtext.md aktualisiert
This commit is contained in:
@@ -218,13 +218,25 @@ Beispiel: Für den Ordner `/var/www/webproject-prod` lautet die Konfigurationsda
|
|||||||
nano /etc/apache2/sites-available/webproject-prod.conf
|
nano /etc/apache2/sites-available/webproject-prod.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
Füge in den `<VirtualHost *:80>`-Block folgende Zeilen ein:
|
Füge in die Datei folgende Zeilen ein:
|
||||||
|
|
||||||
```apache
|
```apache
|
||||||
RewriteEngine On
|
<VirtualHost *:80>
|
||||||
RewriteCond %{HTTPS} off
|
ServerName staging.meinprojekt.de
|
||||||
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
DocumentRoot /var/www/staging
|
||||||
|
|
||||||
|
<Directory /var/www/staging>
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
</VirtualHost>
|
||||||
```
|
```
|
||||||
|
>[!NOTE]
|
||||||
|
>**HTTPS-Redirect nur im Proxy**
|
||||||
|
>Wenn dein Server hinter einem Reverse Proxy wie Nginx Proxy Manager betrieben wird, übernimmt der Proxy die HTTPS-Verschlüsselung und ggf. Weiterleitung von HTTP zu HTTPS.
|
||||||
|
>In diesem Fall darfst du in Apache selbst keinen weiteren Redirect auf HTTPS konfigurieren, da Apache die Verbindung als HTTP wahrnimmt und sonst in eine Endlosschleife geht
|
||||||
|
>→ Browser meldet dann ERR_TOO_MANY_REDIRECTS.
|
||||||
|
|
||||||
|
|
||||||
Speichern und schließen.
|
Speichern und schließen.
|
||||||
|
|
||||||
@@ -287,9 +299,10 @@ Beispielinhalt:
|
|||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
ServerName shop.deinedomain.tld
|
ServerName shop.deinedomain.tld
|
||||||
DocumentRoot /var/www/shop-prod
|
DocumentRoot /var/www/shop-prod
|
||||||
RewriteEngine On
|
<Directory /var/www/blog>
|
||||||
RewriteCond %{HTTPS} off
|
AllowOverride All
|
||||||
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
Require all granted
|
||||||
|
</Directory>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user