Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente | |||
informatique:serveur:web-linux-apache:https_proxy_apache2 [2023/02/09 16:12] – supprimée - modification externe (Unknown date) | informatique:serveur:web-linux-apache:https_proxy_apache2 [2023/02/09 16:12] (Version actuelle) – ↷ Page déplacée de informatique:serveur-web-linux-apache:https_proxy_apache2 à informatique:serveur:web-linux-apache:https_proxy_apache2 Cédric ABONNEL | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ====== Apache 2 : proxy-reverse : configurer un site en https pour un sous-domaine ====== | ||
+ | |||
+ | Voici mes prises de notes pour configurer un site Internet **http**. Le configuration est destinée pour un site Internet commençant par **www**. | ||
+ | |||
+ | < | ||
+ | Configurer Apache 2 | ||
+ | http:// | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Pré requis ===== | ||
+ | |||
+ | Je viens de demander un [[ssl-let-s_encrypt-certbot-auto|certificat SSL]] pour le site Internet. Il faut configurer Apache 2 pour que : | ||
+ | * les demandes en https utilisent le certificat SSL | ||
+ | * toutes les visites en http soit redirigé en https | ||
+ | |||
+ | ====== Configurer ====== | ||
+ | |||
+ | |||
+ | Je complète le fichier de configuration ''/ | ||
+ | |||
+ | < | ||
+ | RewriteEngine On | ||
+ | RewriteCond %{SERVER_NAME} =extra.perdu.com | ||
+ | RewriteCond %{REQUEST_URI} !\.well-known/ | ||
+ | RewriteRule ^ https:// | ||
+ | </ | ||
+ | |||
+ | Puis, j' | ||
+ | J' | ||
+ | * [[linux: | ||
+ | * [[linux: | ||
+ | * Ajout des options SSL | ||
+ | * Ajout de la gestion des certificats | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | |||
+ | ServerName extra.perdu.com | ||
+ | |||
+ | ProxyPreserveHost On | ||
+ | ProxyPass | ||
+ | ProxyPassReverse "/" | ||
+ | | ||
+ | Include / | ||
+ | SSLCertificateFile / | ||
+ | SSLCertificateKeyFile / | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | Les options SSL sont à créer une seule fois sur le serveur. Ces options sont communes à tous les sites Internet que je configure. | ||
+ | Les options dans ''/ | ||
+ | < | ||
+ | SSLEngine on | ||
+ | |||
+ | # intermediate configuration, | ||
+ | SSLProtocol -ALL +TLSv1.2 | ||
+ | SSLCipherSuite ECDHE-RSA-AES256-GCM-SHA384: | ||
+ | |||
+ | SSLHonorCipherOrder | ||
+ | |||
+ | SSLCompression | ||
+ | # | ||
+ | |||
+ | # -- Securité supplémentaire | ||
+ | |||
+ | SSLOptions +StrictRequire | ||
+ | |||
+ | # HSTS (mod_headers is required) (15768000 seconds = 6 months) | ||
+ | Header always set Strict-Transport-Security " | ||
+ | |||
+ | # Always ensure Cookies have " | ||
+ | Header edit Set-Cookie (? | ||
+ | </ | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | |||
+ | Ce qui donne une configuration globale suivante : | ||
+ | |||
+ | < | ||
+ | < | ||
+ | |||
+ | ServerName extra.perdu.com | ||
+ | |||
+ | # ProxyPass devient obsolète avec RewriteRule | ||
+ | ProxyPass / | ||
+ | Alias / | ||
+ | |||
+ | < | ||
+ | Options None | ||
+ | AllowOverride None | ||
+ | Require all granted | ||
+ | AddDefaultCharset off | ||
+ | </ | ||
+ | |||
+ | # Proxy* deviennent obsolète avec Rewrite* | ||
+ | ProxyPreserveHost On | ||
+ | ProxyPass | ||
+ | ProxyPassReverse "/" | ||
+ | |||
+ | RewriteEngine On | ||
+ | RewriteCond %{SERVER_NAME} =info.mindcast.fr | ||
+ | RewriteCond %{REQUEST_URI} !\.well-known/ | ||
+ | RewriteRule ^ https:// | ||
+ | |||
+ | </ | ||
+ | |||
+ | < | ||
+ | < | ||
+ | |||
+ | ServerName extra.perdu.com | ||
+ | |||
+ | ProxyPreserveHost On | ||
+ | ProxyPass | ||
+ | ProxyPassReverse "/" | ||
+ | | ||
+ | Include / | ||
+ | SSLCertificateFile / | ||
+ | SSLCertificateKeyFile / | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | ====== Recharger ====== | ||
+ | |||
+ | Après ces modifications, | ||
+ | < | ||
+ | sudo service apache2 reload | ||
+ | </ | ||
+ | |||
+ | ====== Liens ====== | ||
+ | |||
+ | https:// | ||
+ | |||