From 6db6dc3fd62af6465e8046a6a6561de725642759 Mon Sep 17 00:00:00 2001 From: Sascha Date: Sun, 23 May 2021 11:25:45 +0200 Subject: [PATCH] Replace port using sed and document environment-variable Signed-off-by: Sascha Signed-off-by: Sascha Retter --- README.md | 3 +++ docker-entrypoint.sh | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/README.md b/README.md index 25cfe314..27adbce5 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,9 @@ Check the [Nexcloud documentation](https://docs.nextcloud.com/server/latest/admi Keep in mind that once set, removing these environment variables won't remove these values from the configuration file, due to how Nextcloud merges configuration files together. +## Changing port of Apache +If you want to run Apache on another port e.g. an unprivileged port which might make sense e.g. inside Kubernetes you can set the environment variable `APACHE_PORT`. + # Running this image with docker-compose The easiest way to get a fully featured and functional setup is using a `docker-compose` file. There are too many different possibilities to setup your system, so here are only some examples of what you have to look for. diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index b6da893b..d9bcf89b 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -77,6 +77,11 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP } > /usr/local/etc/php/conf.d/redis-session.ini fi + if [ -n "${APACHE_PORT+x}" ]; then + sed -i "s/VirtualHost \*:80/VirtualHost \*:${APACHE_PORT}/" /etc/apache2/sites-enabled/000-default.conf + sed -i "s/Listen 80/Listen ${APACHE_PORT}/" /etc/apache2/ports.conf + fi + installed_version="0.0.0.0" if [ -f /var/www/html/version.php ]; then # shellcheck disable=SC2016