Generate a self-signed SSL certificate
# apt-get install openssl # openssl req -new -x509 -days 400 -nodes -out apache.pem -keyout apache.pem # chmod 600 apache.pem
Load the certificate into apache2
Put the certificate in a suitable place:
# mv apache.pem /etc/ssl/certs/apache.pem
Make sure that apache2 is installed:
# apt-get install apache2
Enable the ssl module in apache2:
# a2enmod ssl # a2ensite default-ssl
Tell Apache where the certificate is:
Look at "/etc/apache2/sites-enabled/default-ssl". Searching for the string "SSLCertificateFile" should lead you straight to the right section, where there are comments that tell you how to configure that variable. You probably just need to set the configuration to:
SSLCertificateFile /etc/ssl/certs/apache.pem
Load the modified config file with:
# /etc/init.d/apache2 reload # /etc/init.d/apache2 restart # probably unnecessary but healthy.