-echo "
-# we have to enable some directory access through the user's folders.
-# this is probably going to end up repeated in multiple apache files, but
-# hopefully that's not a problem.
-#hmmm: fix above note if it's not a problem.
-#
-# set permissions on the root folders.
-<Directory \"/\">
- Options -ExecCGI +Indexes +FollowSymLinks +Includes
- Order allow,deny
- Allow from all
-</Directory>
-# set permissions on the root of the home folders.
-<Directory \"/home\">
- Options -ExecCGI +Indexes +FollowSymLinks +Includes
- Order allow,deny
- Allow from all
-</Directory>
-# set permissions on the user's home folder.
-<Directory \"$HOME\">
- Options -ExecCGI +Indexes +FollowSymLinks +Includes
- Order allow,deny
- Allow from all
-</Directory>
-# set permissions on the user's app storage folder.
-<Directory \"$BASE_PATH\">
- Options +ExecCGI +Indexes +FollowSymLinks +Includes +MultiViews
- Order allow,deny
- Allow from all
-</Directory>
-# set permissions on the actual app folder.
-<Directory \"$full_path\">
- Options +ExecCGI +Indexes +FollowSymLinks +Includes +MultiViews
- Order allow,deny
- Allow from all
-</Directory>
-<VirtualHost *:80>
- ServerName ${sitename}
-# ServerAlias ${sitename} *.${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
-}
-
-# chown folder to group www-data. can be done without setting a user, right?