Nginx and php-fpm for dockerhub builds
  • Shell 53.9%
  • PHP 25.7%
  • Dockerfile 18.2%
  • HTML 2.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Michael Westergaard 207df04410
All checks were successful
Build images / docker (push) Successful in 7m49s
Prepare release 3.5.1
2026-10-21 20:59:48 +02:00
.forgejo/workflows Build shared small and large images with end-to-end health checks 2026-10-21 20:59:47 +02:00
conf Build shared small and large images with end-to-end health checks 2026-10-21 20:59:47 +02:00
docs Prepare release 3.5.1 2026-10-21 20:59:48 +02:00
errors remove twitter link [skip ci] 2023-03-01 10:29:00 +00:00
scripts Build shared small and large images with end-to-end health checks 2026-10-21 20:59:47 +02:00
src Replace public phpinfo page with a minimal response 2026-10-21 20:40:50 +02:00
tests Build shared small and large images with end-to-end health checks 2026-10-21 20:59:47 +02:00
Dockerfile Build shared small and large images with end-to-end health checks 2026-10-21 20:59:47 +02:00
LICENSE Updated to alpine linux 2016-06-15 15:36:42 +01:00
README.md Prepare release 3.5.1 2026-10-21 20:59:48 +02:00

nginx-php-fpm

Overview

This is a Dockerfile/image to build a container for nginx and php-fpm, with the ability to pull website code from git when the container is created, as well as allowing the container to push and pull changes to the code to and from git. The container also has the ability to update templated files with variables passed to docker in order to update your code and settings. There is support for lets encrypt SSL configurations, custom nginx configs, core nginx/PHP variable overrides for running preferences, X-Forwarded-For headers and UID mapping for local volume support.

If you have improvements or suggestions please open an issue or pull request on the Forgejo project page.

This is based on https://github.com/richarvey/nginx-php-fpm, but updated for modern systems and with bits I don't personally need brutally removed if they caused issues.

Versioning

Docker Tag Git Release Nginx Version PHP Version Alpine Version
latest/3.5.1 3.5.1 1.30.4-r1 8.5.12 3.24.2
small/3.5.1-small 3.5.1 1.30.4-r1 8.5.12 3.24.2
3.5.0 3.5.0 1.30.4-r1 8.5.12 3.24.2
3.2.0 3.2.0 1.30.4-r1 8.2.35 3.24.2

For other tags please see: versioning

NOTE: From 3.2.0, only ARM64 builds are available.

From 3.5.1, the application port is 8080 and the nginx → PHP-FPM health endpoint is 8081/healthz. Git cloning still happens at startup in the same container. Credentials are unset before services start, and all service processes run as nginx after startup drops root.

The -small variant includes MySQLi and GD with JPEG/FreeType, plus the official PHP base's built-in modules. It omits Certbot/Let's Encrypt, MongoDB, Xdebug, nginx Lua/NDK, Composer, SSH, Supervisor, Python and the additional PostgreSQL/PDO-MySQL/Intl/XSL/SOAP/ZIP/EXIF extensions. It includes only the startup, Git-fetch and process-launcher scripts it uses. The large image retains the optional features.

Quick Start

To pull from the Forgejo registry:

docker pull git.westergaard.cloud/klafbang/nginx-php-fpm:latest

Running

To simply run the container:

docker run -d -p 8080:8080 git.westergaard.cloud/klafbang/nginx-php-fpm

To dynamically pull code from git when starting:

docker run -d -p 8080:8080 -e 'GIT_EMAIL=email_address' -e 'GIT_NAME=full_name' -e 'GIT_USERNAME=git_username' -e 'GIT_REPO=github.com/project' -e 'GIT_PERSONAL_TOKEN=<long_token_string_here>' git.westergaard.cloud/klafbang/nginx-php-fpm:latest

You can then browse to http://<DOCKER_HOST>:8080 to view the default install files. To find your DOCKER_HOST use the docker inspect to get the IP address (normally 172.17.0.2)

For more detailed examples and explanations please refer to the documentation.

Documentation

Guides