Debian, Apache, SSL, Multiple Virtual Hosts

After much trial and grief, I've finally nailed how to have multiple SSL virtual hosts running on Apache on our Debian servers alongside non-SSL hosts.

In the 'default' apache config, put:


NameVirtualHost *:80
NameVirtualHost *:443

Then for each virtual host config that you ever create, the opening VirtualHost tag MUST include the relevant port as follows:


< VirtualHost *:443 > (for SSL site)
< VirtualHost *:80 > (for standard site)

Note that I have added a space between the < > tags due to Drupal attempting to format as HTML. Remove the spaces in your config file.

You must then have the ServerName specified inside each Virtual Host.

Somehow it didn't seem that easy at the start!

This site is archived. mig5 is taking a break from writing.