Forum Moderators: phranque

Message Too Old, No Replies

What directives must be included in an SSL VirtualHost container?

Web-based resources often disagree about VirtualHost contents.

         

jdmelton

3:53 pm on Sep 11, 2008 (gmt 0)

10+ Year Member



I have been playing with setting up ssl on Apache/2.2.8 (Ubuntu) with OpenSSL 0.9.8g. I am able to get it working on a test server with a self-signed certificate and a simple static web page but have a question.

The server at ec2-67-***-23-157.compute-1.amazonaws.com is just a test platform and will be destroyed in a couple of days when I finish testing with it. So, its URL inclusion below is OK with me.

My working test vhost file looks like this:

NameVirtualHost *:80
NameVirtualHost *:443
<VirtualHost *:80>
DocumentRoot /var/www/
<Directory />
Some stuff here
</Directory>

Other stuff here

</VirtualHost>
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ec2-67-***-23-157.compute-1.amazonaws.com.crt
SSLCertificateKeyFile /etc/ssl/private/ec2-67-***-23-157.compute-1.amazonaws.com.key
DocumentRoot /var/www/
</VirtualHost>

The contents of the <VirtualHost *:80> container are the default supplied with the Apache 2.2.8 install. I just modified the NameVirtualHost directive and replaced <VirtualHost *> with <VirtualHost *:80>. Then I added the <VirtualHost *:443> container below.

The tutorials often conflict in their instructions. Some say that all of the VirtualHost directives must be copied from *:80 into *:443 and the 3 SSL directives added. Some say that it is only necessary to put the SSL directives in the *:443 container. What I found was that I needed to put the DocumentRoot directive in there which is a mix between the two opinions.

My question is: For a setup like this, what is really necessary for the <VirtualHost *:443> container?

If anyone has experience or can point me to a reference about my question it would be great. The best answer would be a pointer to information so I could learn for myself. I have viewed the Apache 2.2 documents at [httpd.apache.org...] and searched the web. Unfortunately, I have not found a timely answer for my software versions or did not recognize the answer when I saw it.

[edited by: jdMorgan at 3:58 pm (utc) on Sep. 11, 2008]
[edit reason] Obscured hostname for future users. [/edit]