aboutsummaryrefslogtreecommitdiffstats
path: root/files/usr/local/bin/entrypoint.sh
blob: d1a1cc2fcfb21af4e332fc14510b2bb6dce8d3c4 (plain) (blame)
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/sh

# Apache server name change
if [ ! -z "$APACHE_SERVER_NAME" ]
    then
        sed -i "s/#ServerName www.example.com:80/ServerName $APACHE_SERVER_NAME/" /etc/apache2/httpd.conf
        echo "Changed server name to '$APACHE_SERVER_NAME'..."
    else
        echo "NOTICE: Change 'ServerName' globally and hide server message by setting environment variable >> 'APACHE_SERVER_NAME=your.server.name' in docker command or docker-compose file"
fi

# Change apache config
sed -i 's/ServerAdmin\ you@example.com/ServerAdmin\ you@example.com/' /etc/apache2/httpd.conf
sed -i 's/ServerSignature On/ServerSignature Off/' /etc/apache2/httpd.conf
sed -i 's#/var/www/localhost/htdocs#/var/www/app/htdocs#g' /etc/apache2/httpd.conf

# Modify php.ini settings
sed -i 's/memory_limit = .*/memory_limit = 256M/' /etc/php7/php.ini
sed -i "s/^;date.timezone =$/date.timezone = \"Europe\/Stockholm\"/" /etc/php7/php.ini


# display logs
tail -F /var/log/apache2/*log &

echo "Clearing any old processes..."
rm -f /run/apache2/apache2.pid
rm -f /run/apache2/httpd.pid

echo "Starting apache..."
httpd -D FOREGROUND