Skip to content

fondation-unit/docker-wordpress

Repository files navigation

Docker WordPress

A Docker Compose stack for deploying WordPress using a Traefik proxy.

Usage

  1. Copy the sample file .env.sample as .env and fill in the missing information.

  2. Create the network:

sudo docker network create web
sudo docker network create backend
sudo docker network create socket
  1. Set correct permissions on acme.json file to allow Traefik to write certificates:
sudo chmod 600 traefik/acme.json
  1. Build the stack:
sudo docker compose build --no-cache
  1. Run the stack:
sudo docker compose up -d

Systemd services

Copy and activate the Docker systemd service:

cp infra/systemd/docker-wordpress.service /etc/systemd/system
sudo systemctl daemon-reload
sudo systemctl enable docker-wordpress.service
sudo systemctl start docker-wordpress.service

Generate WordPress salt

SSL issues

WordPress may need FORCE_SSL_ADMIN to properly load stylesheets and force HTTPS in the admin dashboard:

define('FORCE_SSL_ADMIN', true);

// If we're behind a proxy server and using HTTPS, we need to alert WordPress of that fact
// see also https://wordpress.org/support/article/administration-over-ssl/#using-a-reverse-proxy
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
  $_SERVER['HTTPS'] = 'on';
}

Restore a database

cat /path/to/dump.sql | sudo docker exec -i db mariadb -u root database-name

About

Docker Compose stack for deploying WordPress using a Traefik proxy.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors