Tuesday, 1 June 2010

Apache+SSL in Debian Quick Setup

Step1: apt-get install apache2 openssl

Step2: (Generate cert file)
mkdir /etc/apache2/ssl

RANDFILE=/dev/random openssl req $@ -new -x509 -days 365 -nodes \
-out /etc/apache2/ssl/apache.pem \
-keyout /etc/apache2/ssl/apache.pem

chmod 600 /etc/apache2/ssl/apache.pem

Step3: (Config for apache2)
cd /etc/apache2/sites-available/
cp default ssl

Step4: (Enable the site. This is done by making a sym-link to the configuration
from /etc/apache2/sites-enabled/.)
a2ensite ssl

Step5: (To enable the ssl module from /etc/apache2/mods-available)
a2enmod ssl

Step6: (Add 443 port to /etc/apache2/ports.conf)
Listen 443

Step7: (Edit /etc/apache2/sites-available/ssl)
NameVirtualHost *:443

SSLEngine On
SSLCertificateFile /etc/apache2/ssl/apache.pem

Step8: Restart apache2 /etc/init.d/apache2 restart

No comments:

Post a Comment