Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Jul 2002 00:33:52 -0400
From:      Simon Carr's Palm 3 HandHeld <palm@simoncarr.com>
To:        "Gary D. Margiotta" <gary@tbe.net>
Cc:        Mark Johnston <mjohnston@skyweb.ca>, 'Odhiambo Washington' <wash@wananchi.com>, freebsd-isp@freebsd.org
Subject:   Re: Scripts to Manage Virtual Hosts
Message-ID:  <BC212A14-9619-11D6-9605-000A278BB05C@simoncarr.com>
In-Reply-To: <Pine.BSF.4.21.0207121029090.45401-300000@thud.tbe.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Gary,

Some thoughts; I've done something similar, but instead of writing all 
the VirtualHosts to one file it just creates a file for each VirtualHost 
called <domain>.conf in a specified directory, then in my httpd.conf 
I've got

include "/usr/local/etc/apache/VirtualHost/"

That'll read all the files in said directory and process them (you can 
see it with an apachectl configtest, it lists each one).  An absolute 
godsend of a feature.

I also toyed with the idea of using mod_sqlinclude, but the idea of my 
DB server going down for the count and then trying to restart an Apache 
server with 100+ VirtualHosts did not sit well... :)

So the process is I've got the user configs in a database, but the 
VirtualHost files themselves are static text that reside in a 
directory.  The perl script reads from the DB and creates any new 
entries, but if the DB server isn't there my Apache isn't crippled 
(totally).  I haven't decided on a good method for disabling accounts 
but I'm getting there.

I haven't dealt with binding VirtualHosts to specific IPs, I just have 
<VirtualHost *>... I'll eventually have to add :80 to the end of that 
when I've got SSL enabled on my servers.

On Friday, July 12, 2002, at 10:34 , Gary D. Margiotta wrote:

> I started writing some perl scripts which I use to add virtualhosts and
> redirects to separate config files.  I didn't like the idea of editing 
> the
> httpd.conf directly, so I made use of the ResourceConfig directive, and
> created 2 files called virtualhosts.conf and redirects.conf which apache
> pulls in when started.
>
> The scripts are currently only able to add entries, and not remove them,
> but should be able to be easily enough modified to include that, I just
> haven't had the time to finish them up.  I want to eventually hook up 
> the
> scripts to keep the info in a database for much easier organization and
> manipulation of domains, but again, lack of time.
>
> You'll notice that it also makes a call to a shell script that gets run 
> to
> ifconfig the virtual IPs on the host interface.  I also run that 
> before I
> restart apache to make sure the new IP takes effect.
>
> -Gary
>
> Running Windows is kinda like playing blackjack:
> User stays on success, reboots on failure
>
>
>> -----Original Message-----
>> From: owner-freebsd-isp@FreeBSD.ORG
>> [mailto:owner-freebsd-isp@FreeBSD.ORG] On Behalf Of Odhiambo Washington
>> Sent: Friday, July 12, 2002 8:51 AM
>> To: FBSD-ISP
>> Subject: Scripts to Manage Virtual Hosts
>>
>>
>> [ I sent this to -questions but got no help ;) ]
>>
>>
>> Hello Users,
>>
>> I believe someone already had written a script that can be used to
>> manipulate
>> httpd.conf to add/remove virtual host entries.
>> I sincerely believe that this is somewhere so I don't have to start
>> agonizing
>> about re-inventing the wheel.
>> Could someone kindly point me to where one is located, better even 
>> share
>> with me
>> what they have ;-)
>>
>>
>> -Wash
>>
>> --
>> Odhiambo Washington  <wash@wananchi.com>    "The box said 'Requires
>> Wananchi Online Ltd.  www.wananchi.com      Windows 95, NT, or better,'
>> Tel: 254 2 313985-9   Fax: 254 2 313922     so I installed FreeBSD."
>> GSM: 254 72 743 223   GSM: 254 733 744 121  This sig is McQ!  :-)
>>
>>
>> The light at the end of the tunnel is the headlight of an approaching
>> train.
>>
>> To Unsubscribe: send mail to majordomo@FreeBSD.org
>> with "unsubscribe freebsd-isp" in the body of the message
>>
>>
>> To Unsubscribe: send mail to majordomo@FreeBSD.org
>> with "unsubscribe freebsd-isp" in the body of the message
>>
>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-isp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BC212A14-9619-11D6-9605-000A278BB05C>