-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathhttpd-foreground
More file actions
executable file
·35 lines (27 loc) · 993 Bytes
/
httpd-foreground
File metadata and controls
executable file
·35 lines (27 loc) · 993 Bytes
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
#!/bin/bash
set -e
# Apache gets grumpy about PID files pre-existing
rm -f /usr/local/apache2/logs/httpd.pid
echo "Configuring Apache2 environment variables..."
# Set ServerName of created container
export APACHE_SERVERNAME="${APACHE_SERVERNAME:-$(cat /etc/hostname)}"
# Support for configuration overrides
include_conf ()
{
file=$1
if [[ -f "$file" ]]; then
echo "Including configuration overrides from $file"
cp "$file" /usr/local/apache2/conf/custom
fi
}
include_conf "/var/www/.docksal/etc/apache/httpd-vhost-overrides.conf"
include_conf "/var/www/.docksal/etc/apache/httpd-vhosts.conf"
# Run in foreground
args="-DFOREGROUND"
# Basic HTTP Authentication
if [[ "$APACHE_BASIC_AUTH_USER" != "" ]] && [[ "$APACHE_BASIC_AUTH_PASS" != "" ]]; then
echo "Enabling Basic HTTP Authentication [$APACHE_BASIC_AUTH_USER:$APACHE_BASIC_AUTH_PASS]"
htpasswd -cb /usr/local/apache2/htpasswd "$APACHE_BASIC_AUTH_USER" "$APACHE_BASIC_AUTH_PASS"
args+=" -DBasicAuth"
fi
exec httpd ${args}