Setting up SSL with Apache2 on Debian Etch

For more detailed instructions, pleae follow the link below and do read the comments too, since the solution I used is mentioned in the comments.

1. Create folder

        # mkdir /etc/apache2/ssl

2. Create SSL certificate (you should have openssl package installed)

        openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/apache.pem \
	-keyout /etc/apache2/ssl/apache.pem

3. Enable SSL Apache module

        klopotec:~# a2enmod ssl
	Module ssl installed; run /etc/init.d/apache2 force-reload to enable.

4. Tell Apache to accept connections on port 443 by adding the line below into /etc/apache2/ports.conf

        Listen 443

5. Configure virtual host adding:

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

i.e.

NameVirtualHost *:443
NameVirtualHost *:80
<VirtualHost *:80>
    ServerName earth.my.flat    DocumentRoot /var/www/

ErrorLog /var/log/apache2/error.log    CustomLog /var/log/apache2/access.log combined

</VirtualHost>
<VirtualHost *:443>    ServerName earth.my.flat

DocumentRoot /var/www/    ErrorLog /var/log/apache2/error.log

CustomLog /var/log/apache2/access.log combined    SSLEngine on

    SSLCertificateFile /etc/apache2/ssl/apache.pem</VirtualHost>

6. Restart/reload Apache

        /etc/init.d/apache2 reload

This walkthrough created on the basis of:
Setting up an SSL server with Apache2

Leave a Reply