A custom debian Bookworm Apache+PHP setup
2.0K
This document describes the specifics of a custom Docker image used for deploying a PHP web application using Apache on Debian Bookworm.
If you need "up-to-date" 8.3 and not a specific version look at the "generic" 8.3 tag.
The image is based on the official PHP Docker image: php:8.x.xx-apache-bookworm
This image is automatically rebuild at 3am, and pushed if update is available
core, mod_so, mod_watchdog, http_core, mod_log_config, mod_logio, mod_version, mod_unixd, mod_access_compat, mod_alias, mod_auth_basic, mod_authn_core, mod_authn_file, mod_authz_core, mod_authz_host, mod_authz_user, mod_autoindex, mod_deflate, mod_dir, mod_env, mod_filter, mod_mime, prefork, mod_negotiation, mod_php, mod_reqtimeout, mod_rewrite, mod_setenvif, mod_status,
The image includes a system update and the installation of libraries required for GD and other extensions:
Here is a sample docker-compose.yml service configuration for this image:
services:
php-apache:
container_name: saintfrater/php8-23-custom:latest
ports:
- 80:80
tty: true
stdin_open: true
volumes:
- public:/var/www/html
volumes:
public:
I do recommend to use a ''separate'' reverse proxy (like NPNPlus, caddy or Traefik)
services:
# Web Server
webserver:
image: saintfrater/php8-3-23-custom:latest
container_name: app-webserver
restart: unless-stopped
# I strongly suggest to use a separate reverse proxy to handle https & public facing
ports:
- 80:80
tty: true
stdin_open: true
volumes:
- public:/var/www/html
environment:
- TZ=Europe/Brussels
depends_on:
- db
networks:
# if you're using reverse proxy, comment "net_frontend" and add your reverse proxy to the "net_backend"
- net_frontend
- net_backend
# MySQL Server
db:
image: mariadb:latest
container_name: app-db
restart: unless-stopped
environment:
# update with YOUR requiered db informations
- MYSQL_DATABASE=my-application-db
# So you don't have to use root, but you can if you like
- MYSQL_USER=my-app-user
# You can use whatever password you like
- MYSQL_PASSWORD=my-app-pwd
# Password for root access
- MARIADB_ROOT_HOST=%
- MARIADB_ROOT_PASSWORD=[PLEASE CHANGE ME]
- TZ=Europe/Brussels
volumes:
- db:/var/lib/mysql
networks:
- net_backend
# comment section for disabling phpmyadmin when not requiered
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: app-phpmyadmin
environment:
- TZ=Europe/Brussels
- PMA_HOST=app-db
- PMA_PORT=3306
- PMA_USER=root
- PMA_PASSWORD=[PLEASE CHANGE ME]
# I strongly suggest to use "custom location" or dedicated hostname on revert proxy instead of exposing this service
ports:
- '8080:80'
depends_on:
- app-db
networks:
# if you're using reverse proxy, comment "net_frontend" and add your reverse proxy to the "net_backend"
- net_backend
- net_frontend
volumes:
db:
public:
networks:
# if you're using reverse proxy, comment "net_frontend" and add your reverse proxy to the "net_backend"
- net_frontend
- net_backend
services:
# Web Server
webserver:
image: saintfrater/php8-3-23-custom:latest
container_name: proj01-webserver
restart: unless-stopped
tty: true
stdin_open: true
volumes:
- public:/var/www/html
environment:
- TZ=Europe/Brussels
depends_on:
- db
networks:
- server
- backend
# MariaDB Server
db:
image: mariadb:latest
container_name: proj01-db
restart: unless-stopped
environment:
# update with YOUR requiered db informations
- MARIADB_DATABASE=__YOUR_DATABASE_NAME__
# So you don't have to use root, but you can if you like
- MARIADB_USER=__YOUR_APPLICATION_USER__
# You can use whatever password you like
- MARIADB_PASSWORD=__YOUR_APPLICATION_DB_PASSWORD__
# Password for root access
- MARIADB_ROOT_HOST=localhost
- MARIADB_ROOT_PASSWORD=__YOUR_DB_ROOT_PASSWORD__
volumes:
- db:/var/lib/mysql
networks:
- backend
# phpMyAdmin
phpmyadmin:
image: phpmyadmin
container_name: proj01-phpmyadmin
restart: unless-stopped
environment:
- TZ=Europe/Brussels
-
# define the SQL host name & connection port
- PMA_HOST=proj01-db
- PMA_PORT=3306
# credentials for connection
- PMA_USER=__YOUR_APPLICATION_USER__ or root
- PMA_PASSWORD=__YOUR_APPLICATION_DB_PASSWORD__ or __YOUR_DB_ROOT_PASSWORD__
depends_on:
- db
networks:
- server
- backend
# webIDE
theia:
image: ghcr.io/eclipse-theia/theia-ide/theia-ide:latest
container_name: proj01-ide
restart: unless-stopped
volumes:
# shared volume
- public:/home/project
# dedicated IDE volume
- theia-data:/home/theia
networks:
- servers
# NGINX Proxy Manager
proxy:
image: jc21/nginx-proxy-manager:2.12.3
container_name: proj01-proxy
restart: unless-stopped
ports:
- 80:80
- 81:81
- 443:443
- 3000:3000
volumes:
- npm-data:/data
- npm-letsencrypt:/etc/letsencrypt
networks:
- servers
volumes:
db:
public:
theia-data:
npm-data:
npm-letsencrypt:
networks:
server:
external: true
backend:
driver: bridge
See https://wiki.nox-rhea.org/tutoriaux/docker-related/docker-apache-php-mysql-ide-proxy for detailed explanation (in french)
Content type
Image
Digest
sha256:4bca12696…
Size
198.4 MB
Last updated
about 1 year ago
docker pull saintfrater/php8-3-23-custom