Create a new certificate for Ubuntu the easy way (but you knew that already)

For the self-signed certificate:

sudo a2enmod ssl

wget http://librarian.launchpad.net/7477840/apache2-ssl.tar.gz

tar -zxvf apache2-ssl.tar.gz

sudo cp apache2-ssl-certificate /usr/sbin/

sudo cp ssleay.cnf /usr/share/apache2/

sudo mkdir /etc/apache2/ssl

cd /etc/apache2/ssl

sudo apache2-ssl-certificate -days 365

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

sudo ln -s /etc/apache2/sites-available/ssl /etc/apache2/sites-enabled/ssl

Modify the ssl site-available:

NameVirtualHost *:443

<virtualhost *:443>

ServerAdmin webmaster@localhost

SSLEngine On

# the following lines are links to the certs

SSLCertificateFile /etc/apache2/ssl/apache.pem

DocumentRoot /var/www/

Everything else stays the same.

Now all that remains is to restart your server:

sudo /etc/init.d/apache2 restart

All done!

Found this online 🙂