bye bye Travis
[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 ubuntu 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
15 a2enmod rewrite proxy_fcgi setenvif ssl
16
17 # in case mod-php was enabled (this is the case at least on GHA's ubuntu with php 5.x and shivammathur/setup-php)
18 # @todo silence errors in a smarter way
19 rm /etc/apache2/mods-enabled/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 # default apache siteaccess found in GHA Ubuntu. We remove it just in case
26 if [ -f /etc/apache2/sites-available/default-ssl.conf ]; then
27     rm /etc/apache2/sites-available/default-ssl.conf
28 fi
29
30 if [ -n "${GITHUB_ACTIONS}" ]; then
31     echo "export TESTS_ROOT_DIR=$(pwd)" >> /etc/apache2/envvars
32 else
33     echo "export TESTS_ROOT_DIR=/var/www/html" >> /etc/apache2/envvars
34 fi
35 echo "export HTTPSERVER=localhost" >> /etc/apache2/envvars
36
37 service apache2 restart