D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] Simpler Apache Virtual Hosts + SSL?

 

Hello.
I've recently enabled SSL on my server, but this has exaggerated a 
problem I was having before. So, I was wondering if anyone could help me 
tidy up my apache virtual hosts.
I must be doing it wrong. I've only got 6 virtualhosts, but they take up 
12 lines each. I'm struggling to manage them. How on earth does anyone 
manage to cope with hundreds or even thousands of hosts?

I have a LAN- 192.168.38.x (but this may be extended to include another 
subnet). Unfortunately, my Internet IP is dynamic.

There are 3 hosts that I want allow access to from the LAN only. At the 
moment I have two Name VirtualHost directives, one for 192.168.38.1:80 
and one for *:80. Those sites that should be only accessible from the 
LAN then get <VirtualHost 192.168.38.1:80> and those that are also 
internet accessible get <VirtualHost 192.168.38.1:80 *:80>. There must 
be a better way of doing this.

The config for each virtualhost is virtually identical, apart from 
documentroot, servername and serveralias.

I want absolutely everything to go into the global server logs at 
/var/log/apache/error_log and access_log, but logs for each virtualhost 
should also go into specific logs in documentroot/logs or something.
Currently this requires 4 log lines for each host.

Then there is SSL. Apparently I can't add *:443 and SSLCert options to 
each host, because then it either doesn't use SSL for either 80 or 443 
or it tries to use SSL for both.

So that means duplicating my entire virtualhosts section and changing 80 
to 443.

Perhaps someone could also tell me what the accepted practice is for SSL:
1. SSL and non-SSL hosts share the same documentroot so that 
https://site.com and http://site.com give the same thing
2. SSL is a subdirectory of the non-SSL site so that https://site.com is 
the same as http://site.com/ssl
3. SSL and non-SSL have completely different documentroots.
4. Something else?


Thanks in advance
Simon

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html