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 : 2013-10-14
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 CONFFILE
="${CONFDIR}/apache.conf"
19 TEMPLATEDIR
="${CONFDIR}/templates"
22 cat "${TEMPLATEDIR}/apache-head.conf" > "${CONFFILE}"
23 for site
in `cat ${CONFDIR}/sites`
25 site_var
="`echo "${site}" | tr '.-' '__'`"
26 site_list
="${site_list}<li><a href=\"/-/${site}/\">${site}</a></li>\n"
27 site_options
="`awk "/^
${site} /{print
\\$2}" "${CONFDIR}/sites
-options
"`"
28 if [ "${site}" = "conventions.auf" ] ; then # exception pour AjaXplorer...
29 sed -e
"s|@SITE_NAME@|${site}|g" -e
"s|@SITE_VAR@|${site_var}|g" \
30 -e
"s|@SITE_OPTIONS@|${site_options}|g" \
31 -e
"s|\(ProxyHTMLURLMap / \)|#\1|" \
32 "${TEMPLATEDIR}/apache-site.conf" >> "${CONFFILE}"
34 sed -e
"s|@SITE_NAME@|${site}|g" -e
"s|@SITE_VAR@|${site_var}|g" \
35 -e
"s|@SITE_OPTIONS@|${site_options}|g" \
36 "${TEMPLATEDIR}/apache-site.conf" >> "${CONFFILE}"
39 cat "${TEMPLATEDIR}/apache-tail.conf" >> "${CONFFILE}"
41 sed -e
"s|@SITE_LIST@|${site_list}|" \
42 "${TEMPLATEDIR}/index.html" > "${SITE_ROOT}/index.html"
44 sed -e
"s|@SITE_NAME@|${SITE_NAME}|" -e
"s|@SITE_ROOT@|${SITE_ROOT}|" \
45 "${TEMPLATEDIR}/apache-site" > "${CONFDIR}/apache-site"
46 sed -e
"s|@SITE_NAME@|${SITE_NAME}|" -e
"s|@SITE_ROOT@|${SITE_ROOT}|" \
47 "${TEMPLATEDIR}/apache-site-ssl" > "${CONFDIR}/apache-site-ssl"
49 echo "Ne pas oublier d'\033[1;31mouvrir sur le pare-feu\033[m !!"
51 echo "Ne pas oublier d'\033[1;31majouter des lignes dans /etc/hosts\033[m pour :"
53 fmt "${CONFDIR}/sites" |
sed -e
"s/^/ /"
55 echo "Puis lancer : \033[1;32mapache2ctl configtest && apache2ctl graceful\033[m"