Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion utils/Dockerfile.slim.blueprint
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ ARG PHP_VERSION
ARG TARGETOS
ARG TARGETARCH
ARG BLACKFIRE_VERSION=1
ARG APACHE_PORT=80
ARG APACHE_PORT_HTTPS=443
ONBUILD ARG TARGETOS=${TARGETOS}
ONBUILD ARG TARGETARCH=${TARGETARCH}
ONBUILD ARG BLACKFIRE_VERSION=${BLACKFIRE_VERSION}
Expand All @@ -21,6 +23,8 @@ ENV TARGETOS=${TARGETOS}
ENV TARGETARCH=${TARGETARCH}
ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION}
ENV PHP_VERSION=${PHP_VERSION}
ENV APACHE_PORT=${APACHE_PORT}
ENV APACHE_PORT_HTTPS=${APACHE_PORT_HTTPS}

# |--------------------------------------------------------------------------
# | Main PHP extensions
Expand Down Expand Up @@ -206,7 +210,7 @@ STOPSIGNAL SIGWINCH

COPY utils/apache2-foreground /usr/local/bin/

EXPOSE 80
EXPOSE ${APACHE_PORT} ${APACHE_PORT_HTTPS}

ENV APACHE_DOCUMENT_ROOT=

Expand Down
11 changes: 11 additions & 0 deletions utils/README.blueprint.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,17 @@ APACHE_DOCUMENT_ROOT=public/
APACHE_DOCUMENT_ROOT=/var/www/html/public
```

## Changing Apache default ports

For the *apache* variant, you can change the default ports of Apache by using the `APACHE_PORT` and `APACHE_PORT_HTTPS` variables:

```bash
# The default port of Apache is 80
APACHE_PORT=8080
# The default SSL port of Apache is 443
APACHE_PORT_HTTPS=8443
```

## Enabling/disabling Apache extensions

You can enable/disable Apache extensions using the `APACHE_EXTENSION_[extension_name]` environment variable.
Expand Down
10 changes: 10 additions & 0 deletions utils/docker-entrypoint-as-root.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ else
export ABSOLUTE_APACHE_DOCUMENT_ROOT="/var/www/html/$APACHE_DOCUMENT_ROOT"
fi

if [[ "$APACHE_PORT" != "80" ]]; then
sudo sed -i 's/80/\${APACHE_PORT}/g' /etc/apache2/ports.conf && \
sudo sed -i 's/80/\${APACHE_PORT}/g' /etc/apache2/sites-available/000-default.conf
fi

if [[ "$APACHE_PORT_HTTPS" != "443" ]]; then
sudo sed -i 's/443/\${APACHE_PORT_HTTPS}/g' /etc/apache2/ports.conf && \
sudo sed -i 's/443/\${APACHE_PORT_HTTPS}/g' /etc/apache2/sites-available/000-default.conf
fi

# We should run the command with the user of the directory... (unless this is Apache, that must run as root...)
if [[ "$@" == "apache2-foreground" ]]; then
/usr/local/bin/apache-expose-envvars.sh;
Expand Down