Skip to content

How to configure Traefik with Docker to run a WordPress website, MySQL database, and Adminer

Notifications You must be signed in to change notification settings

reibengu/traefik-docker-wordpress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Traefik Docker Configuration for WordPress, MySQL, and Adminer

This example project demonstrates how to configure Traefik with Docker to run a WordPress website, MySQL database, and Adminer for database management. It also includes the setup of local SSL certificates using the mkcert library for secure communication.

Prerequisites

Before getting started with this project, make sure you have the following tools and software installed:

Getting Started

  1. Clone this repository to your local machine.
git clone https://github.com/reibengu/traefik-docker-wordpress.git
cd traefik-docker-wordpress
  1. Generate local SSL certificates using mkcert. This step will provide you with SSL certificates for your local development environment.
mkcert -install
mkcert -cert-file ./certs/local-cert.pem -key-file ./certs/local-key.pem traefik.test "*.traefik.test"
  1. Update the /etc/hosts file. To map the configured domains to your local machine's IP address, you'll need to add entries to your /etc/hosts file. Open a terminal and run the following command to edit the file:
sudo nano /etc/hosts

Add the following entries to the file, associating each domain with your local IP address:

127.0.0.1 monitor.traefik.test
127.0.0.1 traefik.test
127.0.0.1 blog.traefik.test
127.0.0.1 db-admin.traefik.test
  1. Start the services using Docker Compose.
docker-compose up -d

This will launch Traefik, WordPress, MySQL, and Adminer containers. Traefik will automatically generate and manage SSL certificates for your services.

  1. Access your services using the custom domains in your browser:

Accessing Containers

You can access the individual containers directly for debugging or management purposes:

  • WordPress Container: docker exec -it traefik-blog-1 bash
  • MySQL Container: docker exec -it traefik-db-1 bash

Security Considerations

This project is intended for local development purposes and may not be suitable for production use. Please ensure that you implement proper security measures, such as securing sensitive data and using real SSL certificates, when deploying to a production environment.

Issues and Contributions

If you encounter any issues or have suggestions for improvements, please open an issue on the GitHub repository.

Happy coding!

About

How to configure Traefik with Docker to run a WordPress website, MySQL database, and Adminer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published