Ajouté par BoboTiG le 03/10/2012 à 01:04
# Générer un certificat
cd /etc/apache2
mkdir ssl
cd ssl
openssl genrsa -out ./server.key 4096
openssl req -new -key ./server.key -x509 -days 3650 -out ./server.crt
# Configuration de Apache :
# Fichier ports.conf, ajouter :
NameVirtualHost *:443
Listen 443
# Fichier httpd.conf, ajouter :
ServerName bobotig.fr
DocumentRoot /var/www/
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/server.crt
SSLCertificateKeyFile /etc/apache2/ssl/server.key
# Pour forcer un domaine en HTTPS :
ServerName bobotig.fr
ServerAlias www.bobotig.fr
Redirect permanent / https://bobotig.fr/
# Activer le module SSL et redémarrer Apache :
a2enmod ssl
service apache2 restart
# Pour tester la nouvelle configuration :
openssl s_client -connect bobotig.fr:443