HTTPS Configuration (with self-signed certificate)
“sudo a2enmod ssl”
“sudo a2ensite default-ssl”
With Apache2 now configured for HTTPS, restart the service to enable the new settings:
“sudo service apache2 restart”
Source: https://help.ubuntu.com/10.04/serverguide/httpd.html
To force https:
Enable mod_rewrite:
"sudo a2enmod rewrite"
Then add the following to “/etc/apache2/sites-available/default” (first thing after <VirtualHost *:80>):
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [L,R]
Finally restart your Apache2 Server again (or force-reload it if you wish):
“sudo service apache2 restart”
Source: http://www.linode.com/wiki/index.php/Apache2_SSL_in_Ubuntu
Thanks, it works for me!
LikeLike