-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapache2-foreground
More file actions
30 lines (24 loc) · 957 Bytes
/
apache2-foreground
File metadata and controls
30 lines (24 loc) · 957 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
#!/bin/sh
set -e
echo "[INFO] Starting Apache entrypoint script..."
# Remove stack size limit
echo "[INFO] Setting unlimited stack size..."
ulimit -s unlimited
# Replace localhost with SITE_URL in vhosts config
if [ -n "${SITE_URL}" ]; then
echo "[INFO] Replacing 'localhost' with '${SITE_URL}' in Apache vhosts config..."
sed -i "s|localhost|${SITE_URL}|g" /etc/httpd/conf/httpd-vhosts.conf
fi
# If APP_SECRET is present (Symfony), change DocumentRoot to /public
if [ -n "${APP_SECRET}" ]; then
echo "[INFO] Symfony APP_SECRET detected. Adjusting DocumentRoot to '/public'..."
sed -i "s|/var/www/htdocs|/var/www/htdocs/public|g" /etc/httpd/conf/httpd-vhosts.conf
fi
# Clean up existing Apache PID file if it exists
if [ -f /tmp/httpd.pid ]; then
echo "[INFO] Removing existing Apache PID file..."
rm -f /tmp/httpd.pid
fi
# Start Apache in the foreground
echo "[INFO] Starting Apache in the foreground..."
exec apachectl -D FOREGROUND "$@"