diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 26346ea..085bb9a 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -132,4 +132,13 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then echo >&2 "========================================================================" fi +if [[ "$1" == apache2* ]]; then + if [ -n "${APACHE_PORT+x}" ]; then + echo "Setting apache port to ${APACHE_PORT}." + sed -i "s/VirtualHost \*:80/VirtualHost \*:${APACHE_PORT}/g" /etc/apache2/sites-enabled/000-default.conf + sed -i "s/Listen 80/Listen ${APACHE_PORT}/g" /etc/apache2/ports.conf + apachectl configtest + fi +fi + exec "$@"