2 # update.sh - outil de génération de configuration de proxy frontal
3 # Copyright ©2012 Agence universitaire de la Francophonie
5 # Licence : GNU General Public License, version 3
6 # Auteur : Progfou <jean-christophe.andre@auf.org>
7 # Création : 2012-02-01
8 # Mise à jour : 2012-02-01
10 # À faire à la mise en place :
11 # sudo apt-get install libapache2-mod-proxy-html
12 # sudo a2enmod proxy_http proxy_html ext_filter headers
14 SITE_NAME
="intranet.auf.org"
15 SITE_ROOT
="/srv/www/${SITE_NAME}"
17 CONFDIR
="/etc/apache2/intranet-proxy"
18 TEMPLATEDIR
="${CONFDIR}/templates"
21 cat "${TEMPLATEDIR}/apache-base.conf" > "${CONFDIR}/apache.conf"
22 for site
in `cat ${CONFDIR}/sites`
24 site_var
="`echo "${site}" | tr '.-' '__'`"
25 site_list
="${site_list}<li><a href=\"/-/${site}/\">${site}</a></li>\n"
26 sed -e
"s|@SITE_NAME@|${site}|g" -e
"s|@SITE_VAR@|${site_var}|g" \
27 "${TEMPLATEDIR}/apache.conf" >> "${CONFDIR}/apache.conf"
29 sed -e
"s|@SITE_LIST@|${site_list}|" \
30 "${TEMPLATEDIR}/index.html" > "${SITE_ROOT}/index.html"
32 sed -e
"s|@SITE_NAME@|${SITE_NAME}|" -e
"s|@SITE_ROOT@|${SITE_ROOT}|" \
33 "${TEMPLATEDIR}/apache-site" > "${CONFDIR}/apache-site"
34 sed -e
"s|@SITE_NAME@|${SITE_NAME}|" -e
"s|@SITE_ROOT@|${SITE_ROOT}|" \
35 "${TEMPLATEDIR}/apache-site-ssl" > "${CONFDIR}/apache-site-ssl"
37 echo "Ne pas oublier d'ajouter des lignes dans /etc/hosts pour :"
39 fmt "${CONFDIR}/sites" |
sed -e
"s/^/ /"
41 echo "Puis lancer : apache2ctl configtest && apache2ctl graceful"