forked from athenaspa/php-apache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
30 lines (24 loc) · 858 Bytes
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
#change the UID/GID of Apache
APACHE_RUN_USER=${APACHE_RUN_USER:=33}
APACHE_RUN_GROUP=${APACHE_RUN_GROUP:=33}
usermod -u $APACHE_RUN_USER www-data
groupmod -g $APACHE_RUN_GROUP www-data
chown -R www-data:www-data /var/www
# ssmtp config
SSMTP_SERVER=${SSMTP_SERVER:-mailhog}
SSMTP_PORT=${SSMTP_PORT:-1025}
SSMTP_HOSTNAME=${SSMTP_HOSTNAME:-localhost}
SSMTP_TO=${SSMTP_TO:-postmaster}
cat << EOF > /etc/ssmtp/ssmtp.conf
root=$SSMTP_TO
mailhub=$SSMTP_SERVER:$SSMTP_PORT
hostname=$SSMTP_HOSTNAME
FromLineOverride=YES
EOF
# Apache gets grumpy about PID files pre-existing
rm -f /var/run/apache2/apache2.pid && \
rm -rf /var/lock/apache2 && \
sed -i "s|DOCUMENT_ROOT|$DOCUMENT_ROOT|g" /etc/apache2/sites-available/default && \
sed -i "s|ENVIRONMENT_VAR|$ENVIRONMENT|g" /etc/apache2/sites-available/default && \
/usr/sbin/apache2ctl -D FOREGROUND