-<VirtualHost *:80>
- ServerName ${sitename}
- DocumentRoot ${full_path}
- ErrorLog \${APACHE_LOG_DIR}/${sitename}-error.log
- CustomLog \${APACHE_LOG_DIR}/${sitename}-access.log combined
- Include /etc/apache2/conf-library/basic-options.conf
- Include /etc/apache2/conf-library/rewrite-enabling.conf
-</VirtualHost>
-" >"$site_config"
-}
-
-# turns on the config file we create above for apache.
-function enable_site()
-{
- local sitename="$1"; shift
- local site_config="/etc/apache2/sites-available/${sitename}.conf"
-
- outfile="$TMP/apacheout.$RANDOM"
- a2ensite "$(basename $site_config)" &>$outfile
- if [ $? -ne 0 ]; then
- # an error happened, so we show the command's output at least.
- cat $outfile
- echo
- echo "There was a problem enabling the apache config file in:"
- echo " $site_config"
- echo "Please consult the apache error logs for more details."
- exit 1
- fi
- \rm "$outfile"
-}
-
-# restarts the apache2 service.
-function restart_apache()
-{
- service apache2 restart
- if [ $? -ne 0 ]; then
- echo "There was a problem restarting the apache2 service."
- echo "Please consult the apache error logs for more details."
- exit 1
- fi
-}
-
-# sets up the serverpilot storage location for a user hosted web site.
-function maybe_create_site_storage()
-{
- local our_app="$1"; shift
- # make sure the base path for storage of all the apps for this user exists.
- local full_path="$BASE_PATH/$our_app"
- if [ ! -d "$full_path" ]; then
- mkdir -p $full_path
- test_or_fail "The app storage path could not be created.\n Path in question is: $full_path"
- fi