Install Apache2 with SSL support on Debian Lenny
Linux / (Quick way to generate Self Signed SSL certificate)
1. Install apache2 on your Debian Lenny
server# apt-get install apache2
2. Install openssl and it's corequirements
server# apt-get install openssl ssl-cert
In case if you need php support as well on your Lenny:
server# apt-get install
libapache2-mod-php5
3. Generate Self Signed SSL certificate
server# openssl req $@ -new -x509 -days 365 -nodes -out
/etc/apache2/apache.pem -keyout
/etc/apache2/apache.pem
You might consider changing the /etc/apache2/apache.pem to whatever
you like your ssl certificate file to be called.
Now you must ensure yourself that the newly generated ssl
certificate has proper permissions issue the command.
server# chmod 600 /etc/apache2/apache.pem
The
default behaviour of the Apache server is to server unencrypted
HTTP traffic on port 80, however in our case we need to enable SSL
connections and therefore configure apache to serve and listen for
traffic on port 443.
Therefore, we need to have
Listen 443 in our
/etc/apache2/ports.conf another thing we should do is to
enable the ssl module with command:
server# a2enmod ssl
That should be it, now we have to restart the Apache
webserver:
server# /etc/init.d/apache2 restart
To enable SSL on virtualhosts it's required to change
NameVirtualHost * in
/etc/apache2/sites-available/default file
to:
NameVirtualHost *:80
NameVirtualHost *:443
To use SSL encryption on a specific Virtualhost, all you need to do
is:
include:
SSLEngine on
SSLCertificateFile /etc/apache2/apache.pem