2020-09-03 19:20:55 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if [ "$apache2_version" != 'latest' ] ; then
|
|
|
|
echo 'ERROR: unable to install Apache2 - only '"'latest'"' version currently supported'
|
|
|
|
exit 30
|
|
|
|
fi
|
|
|
|
|
2020-09-08 17:59:02 +00:00
|
|
|
# check we have ssh access
|
|
|
|
[ -z "$ssh_root" ] && echo "Error: no root ssh configuration specified" && exit 5
|
|
|
|
|
|
|
|
ssh -T $ssh_root << EOSSH
|
2020-09-03 19:20:55 +00:00
|
|
|
echo "Installing Apache2"
|
2020-09-04 20:52:31 +00:00
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
2020-09-04 21:24:19 +00:00
|
|
|
echo "Installing packages .."
|
|
|
|
apt-get install -qq -y apache2
|
|
|
|
echo "Packages installed"
|
2020-09-03 19:20:55 +00:00
|
|
|
ufw allow in "WWW Full"
|
2020-09-03 19:35:29 +00:00
|
|
|
|
|
|
|
sed -i '/export APACHE_RUN_USER=/c\export APACHE_RUN_USER='"$user" /etc/apache2/envvars
|
|
|
|
sed -i '/export APACHE_RUN_GROUP=/c\export APACHE_RUN_GROUP='"$group" /etc/apache2/envvars
|
|
|
|
chown -R "$user:$group" "/var/www/html"
|
|
|
|
echo "Nothing here ..." > /var/www/html/index.html
|
|
|
|
systemctl restart apache2
|
2020-09-03 19:20:55 +00:00
|
|
|
EOSSH
|
|
|
|
|
|
|
|
|