hy-farm/muchang/.docker/php/docker-entrypoint.sh
2026-05-30 20:23:54 +08:00

38 lines
977 B
Bash

#!/bin/sh
set -e
: "${APACHE_DOCUMENT_ROOT:=/var/www/html/home/web}"
placeholder="__FARM3_APACHE_DOCUMENT_ROOT__"
sed -ri -e "s~/var/www/html(/home/web|/backend/web)*~${placeholder}~g" \
/etc/apache2/sites-available/*.conf \
/etc/apache2/apache2.conf \
/etc/apache2/conf-available/*.conf
sed -ri -e "s|${placeholder}|${APACHE_DOCUMENT_ROOT}|g" \
/etc/apache2/sites-available/*.conf \
/etc/apache2/apache2.conf \
/etc/apache2/conf-available/*.conf
if [ -n "${APACHE_ADMIN_ROOT:-}" ]; then
cat >/etc/apache2/conf-available/farm3-admin.conf <<EOF
Alias /admin ${APACHE_ADMIN_ROOT}
<Directory ${APACHE_ADMIN_ROOT}>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Alias /backend/web /var/www/html/backend/web
<Directory /var/www/html/backend/web>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
EOF
a2enconf farm3-admin >/dev/null
fi
exec docker-php-entrypoint "$@"