This is an old revision of the document!
Apache - Activate SSL
Issue the following command:
a2enmod ssl
NOTE: You do not have to edit your ports.conf file because it already contains Listen 443.
Edit /etc/apache2/mods-enabled/ssl.conf (which was moved from mods-available/ssl.conf, along with ssl.load, by the a2enmod ssl command I think. You can move them manually if you like, but I don't know if a2enmod ssl does other tasks as well.):
- /etc/apache2/mods-enabled/ssl.conf
NameVirtualHost [your IP address]:443 < VirtualHost [your IP address]:443> ServerSignature On SSLCertificateFile /path/to/the/certificate/from/your/certificate/company/apache.crt SSLCertificateKeyFile /path/to/the/file/created/in/step/1.key [can be a .pem file too I think] SSLCertificateChainFile /path/to/intermediate/cert.crt [optional, only if yout certificate compay provides you with one] SSLEngine On </VirtualHost >
NOTE: You can also put the line NameVirtualHost [your IP address]:443 into /etc/apache2/apache2.conf for clarity.
Now you can set up the site you want to run using SSL as you normally would. For example, you might have a file called 'mysite.conf' in /etc/apache2/sites-enabled, and you might add this to it:
- /etc/apache2/sites-enabled/mysite.conf
<VirtualHost [your ip]:443> ServerName mysite.com:443 ServerAlias www.mysite.com DocumentRoot /path/to/www/root/for/ssl/site </VirtualHost>
To run a non-ssl site, you might have this entry in the same mysite.conf file:
- /etc/apache2/sites-enabled/mysite.conf
<VirtualHost *:80> ServerName mysite.com ServerAlias *.mysite.com DocumentRoot /path/to/normal/site </VirtualHost>
8. Restart apache, and your site should work