diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..76762ca --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# force LF in entrypoint.sh +entrypoint.sh text eol=lf diff --git a/3.0/apache/entrypoint.sh b/3.0/apache/entrypoint.sh index 1aa7cdc..9e32817 100755 --- a/3.0/apache/entrypoint.sh +++ b/3.0/apache/entrypoint.sh @@ -23,6 +23,8 @@ URL_FORMAT=${URL_FORMAT:-'path'} DEBUG=${DEBUG:-0} DEBUG_SQL=${DEBUG_SQL:-0} +LISTEN_PORT=${LISTEN_PORT:-"80"} + if [ -z "$DB_PASSWORD" ]; then echo >&2 'Error: Missing DB_PASSWORD' exit 1 @@ -33,6 +35,11 @@ if [ -z "$ADMIN_PASSWORD" ]; then exit 1 fi +if [ "$LISTEN_PORT" != "80" ]; then + echo "Info: Customizing Apache Listen port to $LISTEN_PORT" + sed -i "s/80/$LISTEN_PORT/" /etc/apache2/ports.conf /etc/apache2/sites-available/000-default.conf +fi + # Check if database is available if [ -z "$DB_SOCK" ]; then until nc -z -v -w30 $DB_HOST $DB_PORT diff --git a/4.0/apache/entrypoint.sh b/4.0/apache/entrypoint.sh index 02a5149..1a90f29 100755 --- a/4.0/apache/entrypoint.sh +++ b/4.0/apache/entrypoint.sh @@ -27,6 +27,8 @@ URL_FORMAT=${URL_FORMAT:-'path'} DEBUG=${DEBUG:-0} DEBUG_SQL=${DEBUG_SQL:-0} +LISTEN_PORT=${LISTEN_PORT:-"80"} + if [ -z "$DB_PASSWORD" ]; then echo >&2 'Error: Missing DB_PASSWORD' exit 1 @@ -37,6 +39,11 @@ if [ -z "$ADMIN_PASSWORD" ]; then exit 1 fi +if [ "$LISTEN_PORT" != "80" ]; then + echo "Info: Customizing Apache Listen port to $LISTEN_PORT" + sed -i "s/80/$LISTEN_PORT/" /etc/apache2/ports.conf /etc/apache2/sites-available/000-default.conf +fi + # Check if database is available if [ -z "$DB_SOCK" ]; then until nc -z -v -w30 $DB_HOST $DB_PORT diff --git a/README.md b/README.md index 96f6f90..092aa54 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,8 @@ To change to Apache Webserver configuration, mount a Volume into the Container a See the example configuration provided. +If you want to run Apache on a non-privileged port inside the container, just specify a environment variable `LISTEN_PORT` (e.g. `LISTEN_PORT=8080`). + # Using the fpm Image To use the fpm image, you need an additional web server that can proxy http-request to the fpm-port of the container. See *docker-compose.fpm.yml* for example. @@ -112,6 +114,7 @@ For further details on the settings see: https://manual.limesurvey.org/Data_encr | ENCRYPT_KEYPAIR | Data encryption keypair | | ENCRYPT_PUBLIC_KEY | Data encryption public key | | ENCRYPT_SECRET_KEY | Data encryption secret key | +| LISTEN_PORT | Apache: Listen port. Default: 80 | For further details on the settings see: https://manual.limesurvey.org/Optional_settings#Advanced_Path_Settings