The official WordPress image has a PHP-FPM variant, but it still needs a web server to handle HTTP requests. This image provides an Nginx server ready to use as a wordpress:fpm
front-end.
The Nginx configuration in this image is based on the guidelines given by the Wordpress Codex.
$ docker run --name some-nginx --link some-wordpress:wordpress --volumes-from some-wordpress -d -p 8080:80 raulr/nginx-wordpress
POST_MAX_SIZE
: Sets max size of post data allowed. Also affects file uploads (defaults to64m
).BEHIND_PROXY
: Set totrue
if this container is behind a reverse proxy (defaults tofalse
unlessVIRTUAL_HOST
environment variable is set).REAL_IP_HEADER
: Defines the request header that will be used to obtain the real client IP whenBEHIND_PROXY
is set totrue
(defaults toX-Forwarded-For
).REAL_IP_FROM
: Defines trusted addresses to obtain the real client IP whenBEHIND_PROXY
is set totrue
(defaults to172.17.0.0/16
).
... via docker-compose
Example docker-compose.yml
:
version: '2'
services:
wordpress:
image: wordpress:fpm
networks:
- teamthing-network
nginx:
image: conorw/nginx-wordpress
networks:
- teamthing-network
volumes_from:
- wordpress
ports:
- "8080:80"
environment:
POST_MAX_SIZE: 128m
db:
image: mariadb
networks:
- teamthing-network
environment:
MYSQL_ROOT_PASSWORD: example
networks:
teamthing-network:
driver: bridge
OR
wordpress:
image: wordpress:fpm
links:
- db:mysql
nginx:
image: conorw/nginx-wordpress
links:
- wordpress
volumes_from:
- wordpress
ports:
- "8080:80"
environment:
POST_MAX_SIZE: 128m
db:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: example
Run docker-compose up
, wait for it to initialize completely, and visit http://localhost:8080
or http://host-ip:8080
.