This project sets up a WordPress website with a MariaDB database backend and an Nginx web server using Docker. Each component runs in its own container, providing a modular and isolated environment. The setup ensures secure and efficient operation with persistent data storage. You can also check the comments in the files to get additional information.
- Docker Images: Read-only templates used to create containers. They contain the application code, runtime, libraries, and dependencies needed to run the application.
- Docker Containers: Lightweight, standalone, and executable packages that run the application using the image. Containers are isolated but can communicate with each other.
- Docker Networks: Allow containers to communicate with each other. In this project, a custom bridge network (app-network) is used.
- Docker Volumes: Persist data generated and used by Docker containers. Volumes ensure that data is not lost when containers are stopped or restarted.
- Docker Compose: A tool for defining and running multi-container Docker applications. The docker-compose.yml file specifies the services, networks, and volumes needed for the application.
- WordPress: A content management system (CMS) used to create and manage websites. In this project, it runs in a container, with PHP-FPM handling PHP processing.
- Nginx: A high-performance web server used to serve static files and act as a reverse proxy to handle dynamic requests by forwarding them to PHP-FPM. It also manages HTTPS connections.
- MariaDB: An relational database management system (RDBMS) forked from MySQL. It stores all the data for the WordPress site and runs in a dedicated container.
.
|-- Makefile
`-- srcs
|-- docker-compose.yml
|-- .env
`-- requirements
|-- mariadb
| |-- conf
| | `-- 50-server.cnf
| |-- Dockerfile
| `-- tools
| `-- initial_db.sql
|-- nginx
| |-- conf
| | `-- default
| |-- Dockerfile
| `-- tools
| `-- nginx_start.sh
`-- wordpress
|-- conf
| `-- www.conf
|-- Dockerfile
`-- tools
|-- wordpress_start.sh
`-- wp-config.php
- Docker
- Docker Compose
-
Build and Start Services:
make all
-
Stop Services:
make down
-
Rebuild and Restart Services:
make re
-
Clean Up:
make clean
Defines the services (MariaDB, WordPress, Nginx), networks, and volumes.
Contains environment variables for WordPress configuration (e.g., site URL, admin credentials).
50-server.cnf
: Custom MariaDB configuration.initial_db.sql
: SQL script for database initialization.Dockerfile
: Defines the MariaDB image build process.
www.conf
: PHP-FPM configuration.wordpress_start.sh
: Startup script to set up WordPress.wp-config.php
: WordPress configuration file.Dockerfile
: Defines the WordPress image build process.
default
: Nginx configuration file for serving WordPress with SSL.nginx_start.sh
: Startup script to generate SSL certificates.Dockerfile
: Defines the Nginx image build process.
Once the services are up, access the WordPress site at:
https://<your-domain>
or you can use curl