enabling ssl for an apache name based virtual host

From thelinuxwiki
Jump to: navigation, search

This does not take into account SNI, real / paid for signed certs(like Entrust, Verisign, ect.). This example is for a simple, self signed cert. You visitors will get the typical warning page...

ssl cert con untrusted warning1.png


... and they will have to add the exception.


versions

apache: 2.2.25

this example works / was tested on the above version


configuration

the following example configs are taken from the httpd.conf file

NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:80> ServerName www.example.com ServerAlias example.com *.example.com DocumentRoot /var/www/example.com/htdocs DirectoryIndex index.php <directory /var/www/example.com/htdocs> Options FollowSymLinks allow from all </directory> </VirtualHost>
<VirtualHost _default_:443> ServerName www.example.com DocumentRoot /var/www/example.com/htdocs <directory /var/www/example.com/htdocs> Options FollowSymLinks allow from all </directory> </VirtualHost>