/nginx-php-fpm

Nginx and php-fpm for dockerhub builds

Primary LanguageLuaGNU General Public License v3.0GPL-3.0

docker hub docker hub Travis

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 GitHub project page.

Versioning

Docker Tag GitHub Release Nginx Version PHP Version Alpine Version
latest Master Branch 1.13.4 7.1.8 3.4

For other tags please see: versioning

Links

Quick Start

To pull from docker hub:

docker pull richarvey/nginx-php-fpm:latest

Running

To simply run the container:

sudo docker run -d richarvey/nginx-php-fpm

To dynamically pull code from git when starting:

docker run -d -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>' richarvey/nginx-php-fpm:latest

You can then browse to http://<DOCKER_HOST> 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

Notes for this fork

This container is for nginx-fpm image. It includes workaround needed for proper logging from php-fpm. See: docker-library/php#207 https://bugs.php.net/bug.php?id=71880

https://hub.docker.com/r/proemergotech/nginx-php-fpm/

Prometheus Exporter for nginx (see: https://github.com/knyar/nginx-lua-prometheus and https://github.com/ilagnev/docker-alpine-nginx-lua/commit/b3c728df99eecbb5256e31b58420eead521e7fe8 )

Set METRICS_NET env to enable this feature on 9145 port! Hosts allowed by this env, for example: 10.0.0.0/8

Php-fpm status exporter

Go binary is built in the https://github.com/softonic/phpfpm_exporter

We simply copy the built image to this repo for making it simple for now. We should use go to build it or use external container which is not appropriate for multi replica monitoring.

Use pull_php-fpm-exporter-from-container.sh to update the binary.

This go binary works with alpine only a lib should be linked from other path (see Dockerfile)

Build (when changed):

docker build -t proemergotech/nginx-php-fpm:1.2.15 .
docker login
...
docker push proemergotech/nginx-php-fpm:1.2.15