This is a Dockerfile/image to build a container for nginx and php-fpm, optimized for running Laravel applications in a production environment. The container has the ability to pull website code from git when it's created, as well as pushing and pulling changes to/from git. The container also supports updating templated files with variables passed to docker to update code and settings. There is support for Let's Encrypt SSL configurations, custom nginx configs, core nginx/PHP variable overrides, 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.
Docker Tag | Git Release | Nginx Version | PHP Version | Alpine Version |
---|---|---|---|---|
latest/ |
Main Branch | 1.24-r6 | 8.4 | 3.19 |
For other tags please see: versioning
NOTE: From 2.0.5 onwards there are x86 and arm64 builds available
- https://github.com/richarvey/nginx-php-fpm
- https://hub.docker.com/repository/docker/richarvey/nginx-php-fpm/general
To pull from docker hub:
docker pull richarvey/nginx-php-fpm:latest
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.
- Building from source
- Versioning
- Config Flags
- Git Auth
- Git Commands
- Push
- Pull
- Repository layout / webroot
- webroot
- User / Group Identifiers
- Custom Nginx Config files
- REAL IP / X-Forwarded-For Headers
- Scripting and Templating
- Environment Variables
- Lets Encrypt Support
- Setup
- Renewal
- PHP Modules
- Logging and Errors