#!/bin/sh # # This script just adds the entries to our httpd.conf # if you already have dns and such setup, this is what you want for some # quick entries on the go.... # # # sigterm # Rooted Networks Inc. # sigterm@rootednetworks.com # # # A few things you might want to change # put the name of your machine here MAIN_SERVER="web.rootednetworks.com" DOMAIN="$1" USER="$2" IP="$3" GROUP="$4" # Edit these accordingly to your specs of your system HTTPCONF="/usr/local/etc/apache/httpd.conf" APACHECTL="/usr/local/sbin/apachectl restart" # And now, lets get the shit on the move if [ "$1" = "" ]; then echo "Usage: `basename $0` Domain User Ip Group" exit fi if [ "$2" = "" ]; then echo "Usage: `basename $0` Domain User Ip Group" exit fi if [ "$3" = "" ]; then echo "Usage: `basename $0` Domain User Ip Group" exit fi if [ "$4" = "" ]; then echo "Usage `basename $0` Domain User Ip Group" exit fi #adding www.domain.com to httpd.conf echo "" >> $HTTPCONF echo " " >> $HTTPCONF echo " ServerAdmin $USER@$DOMAIN" >> $HTTPCONF echo " ServerName www.$DOMAIN" >> $HTTPCONF echo " DocumentRoot /usr/home/$USER/$DOMAIN/htdocs" >> $HTTPCONF echo " ErrorLog /usr/local/wwwlogs/$DOMAIN_error.log" >> $HTTPCONF echo " CustomLog /usr/local/wwwlogs/$DOMAIN_access.log combined" >> $HTTPCONF echo " Redirect /webmail http://www.rootednetworks.com/webmail" >> $HTTPCONF echo " Alias /cgi-bin /usr/home/$USER/$DOMAIN/cgi-bin" >> $HTTPCONF echo " " >> $HTTPCONF echo " Options Indexes FollowSymLinks MultiViews ExecCGI" >> $HTTPCONF echo " AddHandler cgi-script .pl .cgi" >> $HTTPCONF echo " " >> $HTTPCONF echo " " >> $HTTPCONF echo " Options Indexes FollowSymLinks Multiviews" >> $HTTPCONF echo " AllowOverride All" >> $HTTPCONF echo " order allow,deny" >> $HTTPCONF echo " allow from all" >> $HTTPCONF echo " " >> $HTTPCONF echo " " >> $HTTPCONF echo "" >> $HTTPCONF # add domain.com to apache echo " " >> $HTTPCONF echo " ServerAdmin $USER@$DOMAIN" >> $HTTPCONF echo " ServerName $DOMAIN" >> $HTTPCONF echo " DocumentRoot /usr/home/$USER/$DOMAIN/htdocs" >> $HTTPCONF echo " ErrorLog /usr/local/wwwlogs/$DOMAIN_error.log" >> $HTTPCONF echo " CustomLog /usr/local/wwwlogs/$DOMAIN_access.log combined" >> $HTTPCONF echo " Redirect /webmail http://www.rootednetworks.com/webmail" >> $HTTPCONF echo " Alias /cgi-bin /usr/home/$USER/$DOMAIN/cgi-bin" >> $HTTPCONF echo " " >> $HTTPCONF echo " Options Indexes FollowSymLinks MultiViews ExecCGI" >> $HTTPCONF echo " AddHandler cgi-script .pl .cgi" >> $HTTPCONF echo " " >> $HTTPCONF echo " " >> $HTTPCONF echo " Options Indexes FollowSymLinks Multiviews" >> $HTTPCONF echo " AllowOverride All" >> $HTTPCONF echo " order allow,deny" >> $HTTPCONF echo " allow from all" >> $HTTPCONF echo " " >> $HTTPCONF echo " " >> $HTTPCONF echo "" >> $HTTPCONF echo "" >> $HTTPCONF # create htdocs and cgi-bin and logs in user directory mkdir /usr/home/$USER/$DOMAIN/htdocs && chmod 755 /usr/home/$USER/$DOMAIN/htdocs mkdir /usr/home/$USER/$DOMAINcgi-bin && chown $USER:$GROUP /usr/home/$USER/$DOMAIN/htdocs && chmod 755 /usr/home/$USER/$DOMAIN/cgi-bin mkdir /usr/home/$USER/logs && chown www:$GROUP /usr/home/$USER/logs && chmod 755 /usr/home/$USER/logs cp /usr/local/www/data-dist/new_site.htm /usr/home/$USER/htdocs/index.htm chown -R $USER:$GROUP /usr/home/$USER/$DOMAIN/htdocs chown -R $USER:$GROUP /usr/home/$USER/$DOMAIN/cgi-bin echo "done setting up user directorys" echo "now test it out with a host lookup or www.$DOMAIN" sleep 2 echo "making webalizer configs for $USER" cp /etc/webconfs/template.conf /etc/webconfs/$DOMAIN.conf echo "LogFile /usr/local/wwwlogs/$DOMAIN_access.log" >> /etc/webconfs/$DOMAIN.conf echo "OutputDir /home/$USER/$DOMAIN/htdocs/webstats" >> /etc/webconfs/$DOMAIN.conf echo "HostName www.$DOMAIN" >> /etc/webconfs/$DOMAIN.conf mkdir /usr/home/$USER/$DOMAIN/htdocs/webstats echo "sleep 45" >> /etc/webcrons echo "/usr/local/bin/webalizer -c /etc/webconfs/$DOMAIN.conf" >> /etc/webcrons echo "Done setting up Webalizer for $DOMAIN" sleep 1 echo " " echo "*********************************" echo "DONT FORGET TO SETUP MRTG CONFIGS" echo "*********************************" echo " " echo " " echo "Restart apache? [yes or no]" read answer; if [ "$answer" = "yes" ]; then echo "restarting named" $APACHECTL exit fi if [ "$answer" = "no" ]; then echo "Skipping restart" exit fi # Ok its all done folks, happy hosting... # -sigterm-