GithubHelp home page GithubHelp logo

chappy202 / docker-traefik-wordpress Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thibaut-d/docker-traefik-wordpress

0.0 0.0 0.0 16 KB

This is a template to launch Wordpress sites with Docker Compose and Traefik

Shell 68.18% Dockerfile 31.82%

docker-traefik-wordpress's Introduction

Wordpress template with Docker and Traefik

This is my template to host Wordpress sites on a server.

It uses:

  • Docker
  • Docker Compose
  • Traefik, as a reverse proxy
  • Worpress (of course)
  • Redis, for the cache
  • MySQL
  • PhPMyAdmin, for database administrations
  • Let's Encrypt for SSL certificate generation

How to deploy Wordpress

Server and domains

Have a server with Docker installed and point your domains to your IP:

  • mysite.com
  • sql.mysite.com if you want to use phpmyadmin
  • test1.mysite.com and test2.mysite.com if you want to learn by playing with whoami containers (see traefik/readme.md)

Update the files

Update the files by changing placeholders:

  • traefik/sample.env then rename it .env
  • site/sample.env then rename it .env
  • site/docker-compose.yml if you want to change the containers and networks names (needed if you have several sites)

Launch the containers

Get into the traefik directory and launch it:

cd traefik
docker network create traefik
docker-compose up -d traefik

Then get into the site directory and launch it:

cd ../site
docker-compose up -d

Coffee time! Allow a few minutes for Let's Encrypt to generate the certificates.

Install and configure wordpress

Connect to mysite.com and follow Wordpress installation steps.

You also need to edit the Wordpress configuration file on the server to enable Redis:

sudo nano site/wordpress/data/wp_config.php

Add:

//
// redis config cache for total cache
//
define( 'W3TC_CONFIG_CACHE_ENGINE', 'redis');
define( 'W3TC_CONFIG_CACHE_REDIS_SERVERS', 'redis::6379' );
// optional redis settings
define( 'W3TC_CONFIG_CACHE_REDIS_PERSISTENT', true );
define( 'W3TC_CONFIG_CACHE_REDIS_DBID', 0 );
define( 'W3TC_CONFIG_CACHE_REDIS_PASSWORD', '' );

Install the plugins

Once in Wordpress, install and configure the following plugins:

I also recommend:

  • Neve as a simple and optimized all purpose theme with a nice free version.
  • WP Forms for the contact form
  • Send In Blue as an SMTP provided and Newsletter handeling

Hosting several sites on the same server

Multiple sites can be hosted on the same server thanks to Traefik reverse proxy capabilities.

Just duplicate the original ./site directory and change the container and label names.

Then launch the new site's containers. Traefik will automatically detect it.

cd site2
docker-compose up -d

Detailed explainations

I created a tutorial there: https://thibaut-deveraux.medium.com/a-docker-compose-file-to-install-wordpress-with-a-traefik-reverse-proxy-an-ssl-certificate-and-a-e878c2a03a17

Each directory also contain explainations in its readme.md file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.