Friday, July 10, 2009

HOWTO : Secure Socket Layer (SSL) for LAMP on Ubuntu 9.04 Server

Enable the mod_ssl module.

sudo a2enmod ssl

Edit the default or copy the default to another file for editing.

sudo nano /etc/apache2/sites-available/default

Add the following inside the mod_rewrite.c bracket.

RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}%{REQUEST_URI} [R]

Enable the default-ssl site.

sudo a2ensite default-ssl

Restart apache to reload the setting and make it active.

sudo /etc/init.d/apache2 restart

That's all. See you!