Add SSL Support to an Apache Virtual Host Configuration


Notes on how I usually do it, on Fedora.

  • The interesting directory is /etc/httpd/conf.d
  • One virtual host (and its aliases), per file
  • Files get processed in alpha order
  • use #-sign for comments
  • see http://jwenet.net/notebook/2007/1015.html for http hosts

in the default ssl.conf (/etc/httpd/conf.d/ssl.conf)

  replace this line:
     <VirtualHost _default_:443>
  with these lines:
     # Use name-based virtual hosting.
     NameVirtualHost *:443
     <VirtualHost *:443>

all other hosts, including default host (zzvh.*.conf)

  specify which services they provide explicitly, eg replace or update
    <VirtualHost *>
  definitions with something more like
    <VirtualHost *:80>
    <VirtualHost *:443>
    <VirtualHost *:80 *:443>

  Note that this allows you to provide the same or different services,
  per host, on http and https.  Probably a common thing to want it to
  build the website under https, and then make a "stub" website under
  http that redirects to https.


date: 01/24/2008