Configure https with self-sign certificate

By | 8 August, 2012

1. Tell Apache2 to enable the SSL module.

# sudo a2enmod ssl

2. Generate our certificate…

# cd /tmp
# sudo openssl req -new > new.cert.csr

…when prompted for info, fill it out. Here’s what I typed…

US
Florida
Orlando
SpacemanWorld
(enter)
Jack Spaceman
jackh@spacemanxworld.net
(enter)
(enter)

…and now we continue…

# sudo openssl rsa -in privkey.pem -out new.cert.key
# sudo openssl x509 -in new.cert.csr -out new.cert.cert -req -signkey new.cert.key -days 1825
# sudo cp new.cert.cert /etc/ssl/certs/server.crt
# sudo cp new.cert.key /etc/ssl/private/server.key

3. Now we need to tell Apache2 to use this.

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

4. Edit default-ssl using below option (under “DocumentRoot”):


….
….
SSLEngine on
SSLOptions +StrictRequire
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key

5. Enable Virtual directory ssl

# sudo cd /etc/apache2/sites-enabled
# sudo a2ensite ssl

6. Then restart apache

# sudo service apache2 restart

Source : http://ubuntuforums.org/showthread.php?t=1112664

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.