Apache2_SSL

Revision 5 as of 2012-07-13 23:37:29

Clear message

Help for those who have the desire to run SSL in Apache2:

'1) 'Install apache2 and openssl

sudo apt-get install apache2 openssl

'2) 'Generate a local certificate for our server. Usually it is getting valid for 1 year.

sudo apache2-ssl-certificate-days 365

'3) 'Add the port on which Apache listens for SSL as standard.

echo "Listen 443" >> / etc/apache2/ports.conf

'4) 'Enclose the SSL module.

sudo a2enmod ssl

'5) 'Create and activate SSL page

sudo cp / etc/apache2/sites-available/default / etc/apache2/sites-available/ssl

'6) 'Edit the file you created earlier.

sudo vim / etc/apache2/sites-available/ssl

'7) 'Modify at the beginning of some lines.

NameVirtualHost *: 443
<VirtualHost *:443>
        ServerAdmin webmaster @ localhost

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

        DocumentRoot / var / www /
</ VirtualHost>

'8) 'Enclosed SSL page.

ssl sudo a2ensite

'9) 'Well, and finally restart Apache.

sudo / etc/init.d/apache2 force-reload

And since then we can enjoy an encrypted connection in apache. After entering this address for the first time should ask you to accept the certificate. << BR >> https://localhost