A simple docker-compose Wordpress with Nginx, PHP-FPM, MariaDB, and Redis stack
WordPress is an online, open source website creation tool written in PHP. But in non-geek speak, it’s probably the easiest and most powerful blogging and website content management system (or CMS) in existence today.
- Create persistant volume mount to match directories on host for wordpress containers
- mysql: The database files for MariaDB
- nginx: The Nginx configuration files
- wordpress: The WordPress root folder
- logs/nginx: The Nginx log files (error.log, access.log)
- ssl: certificate folder for HTTPS configuration
Please change "password" to something more secure in ".env"
WORDPRESS_DB_NAME=wordpress
WORDPRESS_TABLE_PREFIX=wp_
WORDPRESS_DB_HOST=mysql
WORDPRESS_DB_USER=root
WORDPRESS_DB_PASSWORD=password
MYSQL_ROOT_PASSWORD=password
MYSQL_USER=root
MYSQL_PASSWORD=password
MYSQL_DATABASE=wordpress
REDIS_MAXMEMORY=128m
REDIS_PASSWORD=password
-
Clone Git with
$ git clone https://github.com/sysopsguy/docker-wordpress.git
-
Start up docker-compose
$ docker-compose up -d
Now access your favourite web browser
-
Go to http://localhost to set up wordpress
-
Create WP-Admin user
-
Go to Plugins > Add New > Search Plugins
-
Type "redis object cache"
-
Click Install now and active
-
Go to plugins setting > Enable Object Cache
-
Define setting in "wp-config.php"
define('WP_CACHE', true);
define('WP_REDIS_HOST', 'redis');
define('WP_REDIS_PORT', '6379');
define('WP_REDIS_PASSWORD', '$3cr3t');
define('FS_METHOD','direct');
-
run command
docker-compose restart
if you cannot find the plugins simply go to https://wordpress.org/plugins/redis-cache/ download and install it manually
Stop docker-compose:
$ cd docker-wordpress
$ docker-compose stop
Remove Docker Containers:
$ docker-compose rm -f
Removing all related directories:
$ rm -rf logs/ mysql/ wordpress/ nginx/
Optional: Removing all Docker images:
$ docker rmi $(docker images -a -q)
- 0.1.1
- Update PHP-FPM to version 7.3
- 0.1.0
- The first release
Sasit Udomwattawee – sasit.u@outlook.com
Distributed under the GNU GPLv3 license. See LICENSE
for more information.
https://github.com/sysopsguy/docker-wordpress
- Fork it (https://github.com/sysopsguy/docker-wordpress/fork)
- Create your feature branch (
git checkout -b new-feature
) - Commit your changes (
git commit -am 'Add some new-feature'
) - Push to the branch (
git push origin new-feature
) - Create a new Pull Request