What could go wrong?
This image aims to simplify building and deploying PHP web applications with a single container you can throw behind traefik or nginx-proxy.
⚠️ Please note: This project is no longer maintained, I suggest using this repo as a starting place for your own container.
The image runs a Go based supervisord port in the foreground which in turn runs nginx/php-fpm in the background. Both nginx & php-fpm are configured to log to stdout/stderr which can then picked up by docker logging as you would expect.
Nginx + PHP-FPM as a single image vs separate images is a bit contentious. While keeping them separate is standard practice: it has a few downsides and not many upsides for most use cases.
This project serves to explore what happens when you treat Nginx + PHP-FPM as a single application and focus on containerization of your code - the thing that really matters.
docker run --rm -it -p 80:80 -v ~/www:/www lslio/nginx-php-fpm
docker run --rm -it -v ~/www:/www -p 80:80 -e SERVER_NAME=example.localhost lslio/nginx-php-fpm
FROM lslio/nginx-php-fpm
ENV SERVER_NAME=example.com
ENV SERVER_ALIAS=www.example.com
ENV SERVER_ROOT=/www
COPY . /www
version: '3.6'
services:
example:
image: lslio/nginx-php-fpm
volumes:
- .:/www
ports:
- "80:80"
environment:
SERVER_NAME: "example.localhost"
version: '3.6'
services:
nginx-proxy:
image: jwilder/nginx-proxy
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
example-web:
image: lslio/nginx-php-fpm
volumes:
- ./web:/www
environment:
VIRTUAL_HOST: "example.localhost"
SERVER_ROOT: "/www/public"
example-api:
image: lslio/nginx-php-fpm
volumes:
- ./api:/www
environment:
VIRTUAL_HOST: "api.example.localhost"
SERVER_ROOT: "/www/public"
Content type
Image
Digest
Size
25.2 MB
Last updated
over 7 years ago
docker pull lslio/nginx-php-fpm