-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathstart
executable file
·46 lines (38 loc) · 1.72 KB
/
start
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
set -e
# Configure PHP date.timezone
echo "date.timezone = $PHP_TIMEZONE" > /usr/local/etc/php/conf.d/timezone.ini
# Configure Apache Document Root
mkdir -p $APACHE_DOC_ROOT
chown www-data:www-data $APACHE_DOC_ROOT
sed -i "s|DocumentRoot /var/www/html\$|DocumentRoot $APACHE_DOC_ROOT|" /etc/apache2/sites-available/000-default.conf
echo "<Directory $APACHE_DOC_ROOT>" > /etc/apache2/conf-available/document-root-directory.conf
echo " AllowOverride All" >> /etc/apache2/conf-available/document-root-directory.conf
echo " Require all granted" >> /etc/apache2/conf-available/document-root-directory.conf
echo "</Directory>" >> /etc/apache2/conf-available/document-root-directory.conf
a2enconf "document-root-directory.conf"
# Set ServerName Directive
echo "ServerName $APACHE_SERVER_NAME" > /etc/apache2/conf-available/server-name.conf
a2enconf "server-name.conf"
# Enable XDebug if needed
if [ "$XDEBUG_ENABLE" = "1" ]; then
docker-php-ext-enable xdebug
mv /usr/local/etc/php/conf.d/99-xdebug.ini.disabled /usr/local/etc/php/conf.d/99-xdebug.ini
# Configure XDebug remote host
if [ -z "$HOST_IP" ]; then
# Allows to set HOST_IP by env variable because could be different from the one which come from ip route command
HOST_IP=$(/sbin/ip route|awk '/default/ { print $3 }')
fi;
echo "xdebug.remote_host=$HOST_IP" > /usr/local/etc/php/conf.d/xdebug_remote_host.ini
fi;
# Configure sSMTP
if [ "$SSMTP_MAILHUB" ]; then
echo "mailhub=$SSMTP_MAILHUB" >> /etc/ssmtp/ssmtp.conf
fi;
if [ "$SSMTP_AUTH_USER" ]; then
echo "AuthUser=$SSMTP_AUTH_USER" >> /etc/ssmtp/ssmtp.conf
fi;
if [ "$SSMTP_AUTH_PASS" ]; then
echo "AuthPass=$SSMTP_AUTH_PASS" >> /etc/ssmtp/ssmtp.conf
fi;
exec "apache2-foreground"