Sign inSign up

andrewmackrodt/php-apache2

By andrewmackrodt

Updated 4 months ago

PHP 8.2 and Apache 2.4 with Let's Encrypt support.

Image
0

10K+

andrewmackrodt/php-apache2 repository overview

andrewmackrodt/docker-php-apache2

Status Pulls Dockerfile Size Version

Combined PHP + Apache2 image using mod_php. This image is recommended for backend applications such as APIs which do not need to serve static assets. While it will work for small to medium sized general purpose applications like WordPress, it will not perform as well as a php-fpm configuration due to the way that Apache prefork functions.

Features

Apache HTTP Server Version 2.4

  • Let's Encrypt certificate generation and renewal
  • X-Forwarded-For support for default docker subnet
  • AllowOverride all configured in /var/www
  • Directory Indexes forbidden in /var/www
  • www-data uses the same UID as the ubuntu account
  • Modules: rewrite, headers, ssl, remoteip

PHP 8.4 and the latest version of composer as of the image build date.

Extensions:

  • Core: cli, common, dev, readline, json, curl
  • Compression: bz2, zip
  • Database: mysql, pgsql, sqlite3, memcached, redis
  • Debug: xdebug*
  • Math: bcmath, gmp
  • Performance: igbinary, opcache
  • Other: gd, imap, intl, mbstring, soap, xml, xsl

* xdebug is only enabled if the environment variable XDEBUG_ENABLE=1.

Usage

LETS_ENCRYPT_ environment variables are optional.

See also andrewmackrodt/php and andrewmackrodt/apache2.

docker
# create the container
docker create \
  --name mysite \
  -p 8080:80 \
  -p 8443:443 \
  -e PUID=$(id -u) \
  -e PGID=(id -g) \
  -e LETS_ENCRYPT_DOMAINS=97e0973.ngrok.io \
  -e [email protected] \
  -e LETS_ENCRYPT_STAGING=0 \
  -e XDEBUG_ENABLE=0 \
  -v $HOME/public_html:/var/www/html \
  -v $HOME/.certbot/mysite:/etc/letsencrypt/live \
  andrewmackrodt/php-apache2

Parameters

ParameterFunction
-p 8080:80Expose port 80 on the host
-p 8443:443Expose port 443 on the host
-e PUID=1000The user id, recommended: $(id -u)
-e PGID=1000The group id, recommended: $(id -g)
-e SUDO_NOPASSWD=0Set to 1 to allow passwordless sudo
-e LETS_ENCRYPT_DOMAINS=Domain's to request certificates for, comma separated
-e LETS_ENCRYPT_EMAIL=E-mail address to receive Let's Encrypt Notifications
-e LETS_ENCRYPT_STAGING=0Set to "1" to use staging server
-e XDEBUG_ENABLE=0Set to "1" to enable xdebug
-v /var/www/htmlApache DocumentRoot
-v /etc/letsencrypt/liveCertbot Let's Encrypt directory

Tag summary

Content type

Image

Digest

sha256:baf4e8bbc

Size

185.5 MB

Last updated

4 months ago

docker pull andrewmackrodt/php-apache2