[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: virtual hosting methods



Actually there is a very nice and nifty feature in apache 1.3.19+ (or was
it 20+) that allows an include filename to be a directory what will
include all directories and subdirs of the named direcotry, and load all
files in those dirs as config files. With some maintenance scripts it
allows very easy maintenance of virtual hosts (configuration...)
and grouping of configuration. For simple masshosting
I still suggest mod_vhost.

regards,

-- 
Martin 'pisi' Paljak / freelancer consultant
pisi@pisitek.com / pisi.pisitek.com


On Sat, 24 Nov 2001, Gavin Hamill wrote:

> On Sat, Nov 24, 2001 at 04:29:06PM -0500, Kevin J. Menard, Jr. wrote:
> > Hey guys,
> >
> >     And I was thinking just have a separate vhost.conf file and modifying
> >     that, then restarting apache with graceful.
>
> This is exactly what I do, with the same filename vhost.conf and
> everything =)
>
> In fact, apache's httpd.conf is configured to read vhost.conf, but any
> of my web-based admin tools (which I wrote) use a file called
> vhost.latest, then this script runs as a cron job every 3 minutes:
>
> #!/bin/bash
>
> diff /etc/apache/vhost.conf /etc/apache/vhost.latest >/dev/null
>
> if [ $? = 1 ] ; then
> 	echo >/tmp/thisisnow `date +%Y%m%d-%H%M%S`
> 	cat /etc/apache/vhost.conf > /etc/apache/vhost.conf.`cat /tmp/thisisnow`
> 	cat /etc/apache/vhost.latest >/etc/apache/vhost.conf
> 	echo >>/var/log/telcust.log `date +%Y-%m-%d-%H-%M-%S` INFO: Rotated vhost.conf
> 	echo Rotating apache configuration!
> 	echo
> 	apachectl configtest
>
> 	if [ $? = 0 ] ; then
> 		apachectl stop
> 		sleep 1
> 		apachectl start
> 		sleep 2
> 		apachectl start
>
> 		pidof /usr/sbin/apache >/dev/null
>
> 		if [ $? = 1 ] ; then
> 			echo >>/var/log/telcust.log `date +%Y-%m-%d-%H-%M-%S` WARN: Apache did not restart
> 			echo DID NOT DETECT ANY RUNNING APACHE PROCESSES!!!
> 			echo
> 			echo End of /var/log/apache/error.log follows
> 			echo
> 			tail /var/log/apache/error.log
> 			cat /etc/apache/vhost.conf.`cat /tmp/thisisnow` >/etc/apache/vhost.conf
> 			apachectl start
> 			echo
> 			echo I have restored the old config file and restarted apache.
> 			echo You will get this error every three minutes as an incentive
> 			echo to fix the problem in /etc/apache/vhost.latest !
> 		else
> 			echo Detected apache processes have restarted OK.
> 		fi
> 	else
> 		echo
> 		echo >>/var/log/telcust.log `date +%Y-%m-%d-%H-%M-%S` WARN: Apache conf failed syntax test
> 		echo Oh dear, the new apache config failed the configtest.
> 		echo Will restore the old config and not restart apache.
> 		cat /etc/apache/vhost.conf.`cat /tmp/thisisnow` >/etc/apache/vhost.conf
> 	fi
>
> fi
>
> -------------------------------------------------
>
> The vhost.latest simply contains lots of <VirtualHost> blocks.
>
> Cheers,
>
>
> gdh
>
>
> --
> To UNSUBSCRIBE, email to debian-isp-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>
>



Reply to: