#!/bin/bash SITE=$1 SERVER=`echo $SITE|cut -f 2 -d '.'` mkdirhier /usr/local/apache/sites/$SITE/cgi-bin/ mkdirhier /usr/local/apache/sites/$SITE/htdocs/ chown -R lvm.lvm /usr/local/apache/sites/$SITE/ chmod -R 0755 /usr/local/apache/sites/$SITE/ cat >>/etc/httpd/conf/httpd.conf < ServerAdmin lvm@mystery.lviv.net DocumentRoot /usr/local/apache/sites/$SITE/htdocs ServerName $SERVER.mystery.lviv.net ErrorLog /var/log/httpd/$SERVER-err CustomLog /var/log/httpd/$SERVER-access_log common ScriptAlias /cgi-bin/ "/usr/local/apache/sites/$SITE/cgi-bin/" AllowOverride None Options ExecCGI Order allow,deny Allow from all VIRTUAL_SITE LINE="`cat /etc/hosts|fgrep '192.168.200.2'`" (cat /etc/hosts|fgrep -v '192.168.200.2';echo "$LINE $SERVER $SERVER.mystery.lviv.net") >/etc/hosts.new && mv -f /etc/hosts /etc/hosts.old && mv /etc/hosts.new /etc/hosts /etc/init.d/httpd reload