config apache avec ssl
root@g:~# a2enmod ssl Enabling module ssl. See /usr/share/doc/apache2.2-common/README.Debian.gz on how to configure SSL and create self-signed certificates. To activate the new configuration, you need to run: service apache2 restart root@g:~# a2enmod rewrite Enabling module rewrite. To activate the new configuration, you need to run: service apache2 restart root@g:~# service apache2 restart [ ok ] Restarting web server: apache2 ... waiting .
<VirtualHost *:80> ServerName domain.tld ServerAlias www.domain.tld RewriteEngine on RewriteCond %{HTTPS} !on RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} </VirtualHost> <VirtualHost *:443> ServerName domain.tld ServerAlias www.domain.tld DocumentRoot /path/to/files/www.domain.tld <Directory /path/to/files> Options -Indexes AllowOverride all Order allow,deny allow from all </Directory> SSLEngine on # SSLCertificateFile : chemin vers le fichier cert.pem SSLCertificateFile /etc/letsencrypt/live/domain.tld/cert.pem # SSLCertificateKeyFile : chemin vers le fichier privkey.pem SSLCertificateKeyFile /etc/letsencrypt/live/domain.tld/privkey.pem # SSLCertificateChainFile : chemin vers le fichier chain.pem SSLCertificateChainFile /etc/letsencrypt/live/domain.tld/chain.pem # SSLProtocol : Active le support de toutes les versions SSL mais SAUF SSLv2 et v3 qui ne sont plus suffisamment sécurisées. SSLProtocol all -SSLv2 -SSLv3 # SSLHonorCipherOrder : Quand activé, le serveur force ses préférences de protocoles et non le navigateur du client. SSLHonorCipherOrder on SSLCompression off # SSLOptions +StrictRequire : Exige une connexion SSL stricte SSLOptions +StrictRequire # SSLCipherSuite : Liste des algorithmes de chiffrement disponibles SSLCipherSuite ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA # Header always set Strict-Transport-Security : ou HSTS. Indique aux navigateurs que seul le https est supporté et le force en définissant une durée d’application (longue). Objectif : éviter les attaques « Man in the middle ». Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" LogLevel warn ErrorLog ${APACHE_LOG_DIR}/www.domain.tld-error.log CustomLog ${APACHE_LOG_DIR}/www.domain.tld-access.log combined </VirtualHost>
Laisser un commentaire