Commit 563f78d3 authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files

Added apache2 support for permanent redirection, and fixed up the config

writing
parent 4a2d356f
......@@ -66,7 +66,7 @@ case "$1" in
echo '<VirtualHost *>' >> $APACHE_CONF_FILE
echo ${RET} | perl -ne '@s = split /\s*,\s*/; print " ServerName ", shift @s, "\n" if @s; print map { " ServerAlias $_\n" } @s;' >> $APACHE_CONF_FILE
db_get mahara/servername
echo " Redirect Permanent / http://${RET}"
echo " Redirect Permanent / http://${RET}" >> $APACHE_CONF_FILE
echo '</VirtualHost>' >> $APACHE_CONF_FILE
fi
......
......@@ -22,6 +22,7 @@ set -e
. /usr/share/debconf/confmodule
TMP_M4_FILE=/tmp/mahara.postinst.m4.tmp
APACHE_CONF_FILE=/etc/apache2/sites-available/mahara
case "$1" in
configure)
......@@ -56,10 +57,20 @@ case "$1" in
db_get mahara/servername
echo "define(__SERVERNAME__,${RET})dnl" >> $TMP_M4_FILE
echo "define(__APACHELOGDIR__,/var/log/apache2)dnl" >> $TMP_M4_FILE
m4 $TMP_M4_FILE /usr/share/mahara/apache.conf.template > /etc/apache2/sites-available/mahara
m4 $TMP_M4_FILE /usr/share/mahara/apache.conf.template > $APACHE_CONF_FILE
ln -f -s /etc/apache2/sites-available/mahara /etc/apache2/sites-enabled/100-mahara
rm -f $TMP_M4_FILE
db_get mahara/serverredirects
if [ -n "${RET}" ]; then
echo '<VirtualHost *>' >> $APACHE_CONF_FILE
echo ${RET} | perl -ne '@s = split /\s*,\s*/; print " ServerName ", shift @s, "\n" if @s; print map { " ServerAlias $_\n" } @s;' >> $APACHE_CONF_FILE
db_get mahara/servername
echo " Redirect Permanent / http://${RET}" >> $APACHE_CONF_FILE
echo '</VirtualHost>' >> $APACHE_CONF_FILE
fi
restart_apache2;
db_get mahara/servername
echo ""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment