forked from splitbrain/docker-phpfarm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·30 lines (23 loc) · 884 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
#!/usr/bin/env bash
#
# Manage the running of Apache httpd.
#
# is a certain UID wanted?
if [ ! -z "$APACHE_UID" ]; then
useradd --home /var/www --gid www-data -M -N --uid $APACHE_UID wwwrun
echo "export APACHE_RUN_USER=wwwrun" >> /etc/apache2/envvars
chown -R wwwrun /var/lib/apache2
fi
# Get value of APACHE_LOG_DIR.
. /etc/apache2/envvars
# Direct logs to stdout/stderr so they will show in 'docker logs' command.
ln -sf /dev/stderr $APACHE_LOG_DIR/error.log
ln -sf /dev/stdout $APACHE_LOG_DIR/access.log
ln -sf /dev/stdout $APACHE_LOG_DIR/other_vhosts_access.log
# Apache gets grumpy about PID files pre-existing
rm -f /var/run/apache2/apache2.pid
# Start Apache in the foreground - Docker needs this to keep the container
# running.
apache2ctl -DFOREGROUND
# No need to tail as Apache log files link to stdout/stderr now.
# tail -f /var/log/apache2/error.log