-
Notifications
You must be signed in to change notification settings - Fork 2
/
start.sh
executable file
·27 lines (23 loc) · 1.28 KB
/
start.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
#!/bin/sh
# Enable commonly used apache modules
sed -i 's/#LoadModule\ rewrite_module/LoadModule\ rewrite_module/' /etc/apache2/httpd.conf
sed -i 's/#LoadModule\ deflate_module/LoadModule\ deflate_module/' /etc/apache2/httpd.conf
sed -i 's/#LoadModule\ expires_module/LoadModule\ expires_module/' /etc/apache2/httpd.conf
sed -i "s#^DocumentRoot \".*#DocumentRoot \"/app/$WEBAPP_ROOT\"#g" /etc/apache2/httpd.conf
sed -i "s#/var/www/localhost/htdocs#/app/$WEBAPP_ROOT#" /etc/apache2/httpd.conf
printf "\n<Directory \"/app/$WEBAPP_ROOT\">\n\tAllowOverride All\n</Directory>\n" >> /etc/apache2/httpd.conf
if [ -z "$WEBAPP_USER_ID" ]; then
chown -R apache:apache /app
else
# Override apache user under which apache runs its child processes with the one provided
# Useful for running container in development mode enabling live code modification
runApacheAsUser=webapp
apacheConfigPath="/etc/apache2/httpd.conf"
addgroup -g $WEBAPP_USER_ID $runApacheAsUser
adduser -D -H -g "webapp user" -G $runApacheAsUser -u $WEBAPP_USER_ID $runApacheAsUser
chown -R $WEBAPP_USER_ID:$WEBAPP_USER_ID /app
chmod 777 /app
sed -i "s/User apache/User $runApacheAsUser/" $apacheConfigPath
sed -i "s/Group apache/Group $runApacheAsUser/" $apacheConfigPath
fi
httpd -D FOREGROUND -e debug