From 6c3cb768835c0fa856fbc7ba97134efb5abfbc6f Mon Sep 17 00:00:00 2001 From: Craig Buchek Date: Sat, 3 Dec 2011 12:39:40 -0600 Subject: [PATCH] Add sbin/a2addsite: Creates directories and a basic config file for an Apache 2 web site. --- sbin/a2addsite | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 sbin/a2addsite diff --git a/sbin/a2addsite b/sbin/a2addsite new file mode 100755 index 0000000..8d0b33f --- /dev/null +++ b/sbin/a2addsite @@ -0,0 +1,47 @@ +#!/bin/bash + +# NOTE: These may vary between distros. +SITE_CONFIG_DIR=/etc/apache2/sites-available +WEB_DIR=/var/www +LOG_DIR=/var/log/apache2 + +SITE=$1 +PROGRAM=$(basename $0) +CONFIG_FILE="$SITE_CONFIG_DIR/$SITE" + +# Usage info +if [ $# -ne 1 ] || [ $1 == "--help" ] ; then + cat < $CONFIG_FILE < + ServerName $SITE + UseCanonicalName On + + CustomLog $LOG_DIR/$SITE/access.log combined + ErrorLog $LOG_DIR/$SITE/error.log + + DocumentRoot $WEB_DIR/$SITE/public + + AllowOverride All + Options FollowSymLinks + Order allow,deny + Allow from all + + Alias /uploads $WEB_DIR/$SITE/uploads + +CONFIG