Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(apache2-foreground,Dockerfile-linux.template): Add support for TLS/HTTPS in Apache2, based on base64 files in ENV #1559

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions 8.1/bookworm/apache/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions 8.1/bookworm/apache/apache2-foreground

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions 8.1/bullseye/apache/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions 8.1/bullseye/apache/apache2-foreground

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions 8.2/bookworm/apache/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions 8.2/bookworm/apache/apache2-foreground

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions 8.2/bullseye/apache/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions 8.2/bullseye/apache/apache2-foreground

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions 8.3-rc/bookworm/apache/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions 8.3-rc/bookworm/apache/apache2-foreground

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions 8.3-rc/bullseye/apache/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions 8.3-rc/bullseye/apache/apache2-foreground

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions 8.3/bookworm/apache/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions 8.3/bookworm/apache/apache2-foreground

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions 8.3/bullseye/apache/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions 8.3/bullseye/apache/apache2-foreground

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions 8.4-rc/bookworm/apache/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions 8.4-rc/bookworm/apache/apache2-foreground

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions 8.4-rc/bullseye/apache/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions 8.4-rc/bullseye/apache/apache2-foreground

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions 8.4/bookworm/apache/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions 8.4/bookworm/apache/apache2-foreground

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions 8.4/bullseye/apache/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions 8.4/bullseye/apache/apache2-foreground

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Dockerfile-linux.template
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ COPY apache2-foreground /usr/local/bin/
WORKDIR /var/www/html

EXPOSE 80
EXPOSE 443
{{ ) elif env.variant == "fpm" then ( -}}
WORKDIR /var/www/html

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ For more information about the full official images change lifecycle, see [the "

For outstanding `php` image PRs, check [PRs with the "library/php" label on the official-images repository](https://github.com/docker-library/official-images/labels/library%2Fphp). For the current "source of truth" for [`php`](https://hub.docker.com/_/php/), see [the `library/php` file in the official-images repository](https://github.com/docker-library/official-images/blob/master/library/php).


<!-- THIS FILE IS GENERATED BY https://github.com/docker-library/docs/blob/master/generate-repo-stub-readme.sh -->
16 changes: 16 additions & 0 deletions apache2-foreground
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ set -e
# Note: we don't just use "apache2ctl" here because it itself is just a shell-script wrapper around apache2 which provides extra functionality like "apache2ctl start" for launching apache2 in the background.
# (also, when run as "apache2ctl <apache args>", it does not use "exec", which leaves an undesirable resident shell process)

# Default SSL directory
SSL_DIR=${APACHE_SSL_DIR:-/etc/apache2/ssl}

# Create the directory if it doesn't exist
# Check and decode the certificate and key
if [ -n "$APACHE_CERT_BASE64" ] && [ -n "$APACHE_KEY_BASE64" ]; then
mkdir -p "$SSL_DIR"
echo "$APACHE_CERT_BASE64" | base64 -d > "$SSL_DIR/apache-cert.pem.crt"
echo "$APACHE_KEY_BASE64" | base64 -d > "$SSL_DIR/apache-key.pem.key"
sed -i "s|/etc/ssl/certs/ssl-cert-snakeoil.pem|$SSL_DIR/apache-cert.pem.crt|g" /etc/apache2/sites-available/default-ssl.conf
sed -i "s|/etc/ssl/private/ssl-cert-snakeoil.key|$SSL_DIR/apache-key.pem.key|g" /etc/apache2/sites-available/default-ssl.conf
ln -s /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-enabled/default-ssl.conf
chmod 0755 "$SSL_DIR/apache-cert.pem.crt" "$SSL_DIR/apache-key.pem.key" /etc/apache2/sites-enabled/default-ssl.conf
a2enmod ssl
fi

: "${APACHE_CONFDIR:=/etc/apache2}"
: "${APACHE_ENVVARS:=$APACHE_CONFDIR/envvars}"
if test -f "$APACHE_ENVVARS"; then
Expand Down