Ok I'm tired of rewriting the same stuff for apache over and over.. so I'm guna make a qdh (quick 'n dirty hack) to generate stuff for me.. yaa!
ok let's startout with a skeleton file the name should be skel.vhost
<VirtualHost *>
ServerName site_name
ServerAlias site_alias
ServerAdmin admin_contact
DocumentRoot base_path
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory base_path>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel Warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
now let's create our script to update & change all this funkie stuff
#!/bin/bash
#let's clear things up
clear
#lets make sure we wanta
echo "Are you sure you want to add a new virtualHost and restart apache2? Hit enter to continue, anything and enter to quit."
read choice
if [ -n $choice]; then
exit 0
fi
while ! [ $confirm ]; do
#echo we will need a site name so let's ask for one
echo "What site name/url would you like to configure?"
read site_name
echo "What if any aliases for this url do you want?"
read site_alias
echo "Who is yer administrative contact for this address/url?"
read site_contact
echo "What will be the base path for this site?"
read base_path
#lets confirm everything
clear
done
sed \
-e "s/site_name/$site_name/g" \
-e "s/site_alias/$site_alias/g" \
-e "s/site_contact/$site_contact/g" \
-e "s/base_path/$base_path/g
# we could probably add crontabs I'll give it a try later
# but for now I wont
#exit nice
exit 0
I accept no liability for you using this.. I was having some problems with apache.. so I wrote a shell script to ease up some of the vhost configuration problems I was having. This prity much automates it.. It's probably not the best way to do this, nore will (I know this for a fact) work for everyone. I use debian and it's got difrent paths's than redhat and others. So Some will have to tune it to work for them.
I am only submiting it because it's kinda nifty, and someone else may be able to use it. I do ask one thing.. if you use this and edit it.. please repost it here (or where ever apropreot) and let others from your experience.
Let the flames begin!