/docker-compose-wordpress

WordPress with Nginx, php7-fpm, Sendmail, MySQL and PhpMyAdmin

Primary LanguageShellMIT LicenseMIT

WordPress with nginx, php7-fpm, sendmail,MySQL and PhpMyAdmin

Built using Oficial images:

  • Nginx.
  • PHP altered to install docker-php-ext-install pdo pdo_mysql mysqli sendmail (check /php folder).
  • MySQL.
  • PHPMyAdmin.

Get repo on your server

  • Run git clone https://github.com/abdo-farag/docker-compose-wordpress.git
  • Run cd docker-compose-wordpress

Environment variables

  • Edit .env and set environment variables.
# APP Name
APP=appname

# Set persistent directories for 
# the database and WordPress.
PERSISTENT_APP=/opt/wordpress
PERSISTENT_DB=/opt/mysql

# mysql
MYSQL_HOST=mysql
MYSQL_ROOT_PASSWORD=pwd
MYSQL_DATABASE=db
MYSQL_USER=user
MYSQL_PASSWORD=secret

Create needed directories that will act as Persistent Volume

  • Run mkdir -p /opt/logs/nginx
  • Run mkdir -p /opt/mysql
  • Run mkdir -p /opt/nginx/conf.d/
  • Run mkdir -p /opt/wordpress
  • Run cp nginx/conf.d/* /opt/nginx/conf.d/

Get WordPress

Download WordPress into the main folder. Can change name and update PERSISTENT_APP value.

Generate TLS certificate Using Let's Encrypt Docker Image

  • Run docker run -it --rm -p 443:443 -p 80:80 --name letsencrypt -v "/etc/letsencrypt:/etc/letsencrypt" -v "/var/lib/letsencrypt:/var/lib/letsencrypt" quay.io/letsencrypt/letsencrypt:latest auth

Run Docker

Once running

Requirements