Serve php7 app with nginx and php7-fpm
764
This is a Dockerfile to build a container image for nginx and php-fpm, with the ability to pull website code from git. The container also has the ability to update templated files with vaiables passed to docker in order to update your settings.
The source files for this project can be found here: https://github.com/ngineered/nginx-php-fpm
If you have any improvements please submit a pull request.
The Docker hub build can be found here: https://registry.hub.docker.com/u/richarvey/nginx-php-fpm/
| Tag | Nginx | PHP | Alpine |
|---|---|---|---|
| latest | 1.10.1 | 5.6.21 | 3.4 |
| php5 | 1.10.1 | 5.6.21 | 3.4 |
| php7 | 1.10.1 | 7.0.7 | 3.4 |
To build from source you need to clone the git repo and run docker build:
git clone https://github.com/ngineered/nginx-php-fpm.git
docker build -t nginx-php-fpm:latest .
Pull the image from docker hub rather than downloading the git repo. This prevents you having to build the image on every docker host:
docker pull richarvey/nginx-php-fpm:latest
To simply run the container:
sudo docker run -d richarvey/nginx-php-fpm
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.
If you want to link to your web site directory on the docker host to the container run:
sudo docker run -d -v /your_code_directory:/var/www/html richarvey/nginx-php-fpm
All logs should now print out in stdout/stderr and are available via the docker logs command:
docker logs <CONTAINER_NAME>
If you want to display PHP errors on screen (in the browser) for debugging purposes use this feature:
-e ERRORS=1
Content type
Image
Digest
Size
82.4 MB
Last updated
about 7 years ago
docker pull minhdanh/nginx-php7-fpm