# Install apache2:
apt-get install apache2
# Generating A Certificate
export RANDFILE=/dev/random
mkdir /etc/apache2/ssl
openssl req $@ -new -x509 -days 365 -nodes -out \
/etc/apache2/ssl/apache.pem -keyout /etc/apache2/ssl/apache.pem
chown www-data:www-data /etc/apache2/ssl/apache.pem
chmod 600 /etc/apache2/ssl/apache.pem
# Enabling SSL Support
a2enmod ssl
NameVirtualHost *:80
NameVirtualHost *:443
<VirtualHost *:80>
...
</VirtualHost>
<VirtualHost *:443>
<!-- Copy all contents from *:80 and paste here -->
...
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
</VirtualHost>