Difference between revisions of "enabling ssl for an apache name based virtual host"
From thelinuxwiki
(→configuration) |
|||
Line 19: | Line 19: | ||
NameVirtualHost *:80 | NameVirtualHost *:80 | ||
NameVirtualHost *:443 | NameVirtualHost *:443 | ||
− | + | <br><VirtualHost *:80> | |
− | <VirtualHost *:80> | + | |
ServerName www.example.com | ServerName www.example.com | ||
ServerAlias example.com *.example.com | ServerAlias example.com *.example.com | ||
Line 30: | Line 29: | ||
</directory> | </directory> | ||
</VirtualHost> | </VirtualHost> | ||
− | + | <br><VirtualHost _default_:443> | |
− | <VirtualHost _default_:443> | + | |
ServerName www.example.com | ServerName www.example.com | ||
DocumentRoot /var/www/example.com/htdocs | DocumentRoot /var/www/example.com/htdocs |
Latest revision as of 15:09, 7 May 2014
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...
... 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>