[Sussex] Apache + SSL + virtual host

Ronan Chilvers ronan at thelittledot.com
Wed May 25 08:56:20 UTC 2005


Diego Moore wrote:
> On 5/25/05, Ronan Chilvers <ronan at thelittledot.com> wrote:
>
>>You can, you just can't have more than one SSL site.  So
>>
>>NameVirtualHost *:80
>>NameVirtualHost *:443
>>
>><VirtualHost *:80>
>>        ServerName www.site1.com
>>        Blah
>></VirtualHost>
>>
>><VirtualHost *:80>
>>        ServerName www.site2.com
>>        Blah
>></VirtualHost>
>>
>><VirtualHost *:443>
>>        ServerName secure.site3.com
>>        Blah
>></VirtualHost>
>
>
> This is now starting to make sense...
>
> On this server a php script redirects you to https://www.example.com/
>
> Base on the above, would I have to run the 3 sites (example.com,
> https://example.com and dev.example.com) as VritualHosts?
>
> Can I not have example.com as the default site and add https and dev
> as VirtualHosts?

I guess you could do that.  I generally do it the above way because its
a bit cleaner.  Plus if you have many different domain names, its easier
to control.  Usually I have the hostname of the server as the default
ServerName and then all active websites are in VirtualHost containers.
I've found it easier to seperate out and manage logging, permissions,
etc if your hosts are neatly sectioned up as vhosts.

So you might end up with (following your example):-

NameVirtualHost *:80
NameVirtualHost *:443

#Main site
<VirtualHost *:80>
	ServerName www.example.com
	Blah
</VirtualHost>
<VirtualHost *:443>
	ServerName www.example.com
	Blah
</VirtualHost>

# Dev site
<VirtualHost *:80>
	ServerName dev.example.com
	Blah
</VirtualHost>

You could add

<VirtualHost *:443>
	ServerName dev.example.com
	Blah
</VirtualHost>

which I guess would work to add in your secure dev site and just click
your way through the warnings from your browser.

The request headers are always read and parsed, including HTTP/1.1
headers, by apache regardless of whether its SSL encrypted or not, so
VirtualHost containers do work with SSL sites in tandem with non-SSL sites.

HTH
--
Ronan

e: ronan at thelittledot.com
w: www.thelittledot.com
t: 01903 739 997
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://mailman.lug.org.uk/pipermail/sussex/attachments/20050525/211f462b/attachment.pgp 


More information about the Sussex mailing list