Short tutorial on setting up SSL site on Ubuntu.

1) Make sure apache is working correctly without SSL

2) Enable SSL apache module
sudo a2enmod ssl

3) Add generate self-signed certificate
cd /etc/apache2/
mkdir ssl
sudo openssl req -new -x509 -nodes -days 365 -out server.crt -keyout server.key
sudo chmod o-r server.key

4) Add port 443 to main virtual host. Edit /etc/apache2/sites-enabled/000-default

ServerName localhost

# require ssl
RewriteEngine On
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]


ServerAdmin webmaster@localhost
ServerName localhost

DocumentRoot ….

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/server.crt
SSLCertificateKeyFile /etc/apache2/ssl/server.key
….

5) Restart apache
sudo apache2ctl restart

6) Test

7) Add certificate to Chromium
sudo apt-get install certutil
certutil -d sql:/home/rrafal/.pki/nssdb/ -A -t “C,,” -n home.radulski.net -i /etc/apache2/ssl/server.crt