wip github actions CI
[plcapi.git] / tests / ci / setup / setup_apache.sh
1 #!/bin/sh
2
3 # Install and configure apache2
4 # Has to be run as admin
5 # @todo make this work across all apache versions (precise to focal)
6
7 set -e
8
9 SCRIPT_DIR="$(dirname -- "$(readlink -f "$0")")"
10
11 DEBIAN_FRONTEND=noninteractive apt-get install -y apache2
12
13 # set up Apache for php-fpm
14 # @see https://github.com/travis-ci/travis-ci.github.com/blob/master/docs/user/languages/php.md#apache--php
15
16 a2enmod rewrite proxy_fcgi setenvif ssl
17
18 # in case mod-php was enabled (this is the case on github's ubuntu with php 5.x at least)
19 a2dismod php || true
20
21 # configure apache virtual hosts
22
23 cp -f "$SCRIPT_DIR/../config/apache_vhost" /etc/apache2/sites-available/000-default.conf
24
25 if [ -n "${TRAVIS}" ]; then
26     echo "export TESTS_ROOT_DIR=$(pwd)" >> /etc/apache2/envvars
27 else
28     echo "export TESTS_ROOT_DIR=/var/www/html" >> /etc/apache2/envvars
29 fi
30 echo "export HTTPSERVER=localhost" >> /etc/apache2/envvars
31
32 ls -la /etc/apache2/mods-enabled
33
34 service apache2 restart