This project has been created as part of the 42 curriculum by ipavlov.
This project has been created as part of the 42 curriculum by ipavlov. This project aims to broaden your knowledge of system administration by using Docker. You will virtualise several Docker images, creating them in your new personal virtual machine.
This project sets up a complete web infrastructure using Docker and Docker Compose, including:
- NGINX (with SSL/TLS)
- WordPress (PHP-FPM)
- MariaDB
- Persistent storage using volumes
The architecture follows a modular container-based design:
Browser → NGINX → WordPress (PHP-FPM) → MariaDB
- NGINX handles HTTPS requests
- WordPress serves dynamic content via PHP-FPM
- MariaDB stores all application data
- Volumes ensure data persistence
inception/
├── Makefile
├── srcs/
│ ├── docker-compose.yml
│ ├── .env
│ └── requirements/
│ ├── nginx/
│ │ ├── Dockerfile
│ │ └── conf/default.conf
│ ├── wordpress/
│ │ ├── Dockerfile
│ │ └── tools/setup.sh
│ └── mariadb/
│ ├── Dockerfile
│ └── tools/setup.sh
git clone https://github.com/12Ivan03/inception.git
cd inceptionAdd and edit the .env file inside srcs/:
DOMAIN_NAME=<name>.42.fr
MYSQL_DATABASE=
MYSQL_USER=
MYSQL_ROOT_PASSWORD=
WORDPRESS_TITLE=
WORDPRESS_ADMIN_USER=
WORDPRESS_ADMIN_EMAIL=
WORDPRESS_USER=
WORDPRESS_USER_EMAIL=
Configure secrets
Create a secrets/ folder at the root of the project:
mkdir secretsAdd the following files
secrets/db_password.txt
secrets/db_root_password.txt
secrets/wp_ad_password.txt
secrets/wp_us_password.txtEach file should contain only the password, for example:
my_passwordAdd this line to /etc/hosts:
127.0.0.1 <name>.42.fr
mkdir -p /Users/your-username/datamakehttps://<your-username>.42.fr
WordPress Login:
Admin Dashboard:
make/make up→ start containersmake down→ stop containers (keeps data)make clean→ remove containers and networksmake fclean→ full cleanup (⚠️ removes images and cache)make re→ rebuild everything
- NGINX listens on port 443 and handles HTTPS requests
- It forwards PHP requests to the WordPress container via FastCGI
- WordPress communicates with MariaDB using the service name
mariadb - Docker provides internal DNS so services can resolve each other by name
🔹 NGINX
- Handles HTTPS traffic (port 443)
- Uses a self-signed SSL certificate
- Forwards PHP requests to WordPress 🔹 WordPress
- Runs with PHP-FPM (port 9000)
- Installed automatically using wp-cli
- Creates admin + normal user 🔹 MariaDB
- Stores WordPress data
- Initialised via setup script
- Persistent storage via volume
The project uses bind-mounted volumes to persist data:
- MariaDB stores its database in
/var/lib/mysql - WordPress stores its files in
/var/www/html
These are mapped to host directories:
/Users/your-username/data/mariadb /Users/your-username/data/wordpress
This ensures that:
- Data is not lost when containers are removed
- The system survives reboots
- Files can be inspected directly from the host
Data is stored on the host machine using bind-mounted volumes:
/Users/<your-username>/data/mariadb
/Users/<your-username>/data/wordpress
This ensures:
Data survives container restart Data survives system reboot Easy inspection and debugging
🔐 Security Notes
- HTTPS enforced using TLS
- Self-signed certificate generated via OpenSSL
- No credentials are stored in the repository
- All sensitive data is stored in
.env
Check containers:
docker compose -f srcs/docker-compose.yml ps
Access MariaDB:
docker compose exec mariadb bash
mysql -u root -p
Access WordPress container:
docker compose exec wordpress bash
- Docker documentation: https://docs.docker.com/
- Docker Compose: https://docs.docker.com/compose/
- NGINX: https://nginx.org/en/docs/
- WordPress: https://developer.wordpress.org/
- MariaDB: https://mariadb.org/documentation/
AI tools (such as ChatGPT) were used during this project to:
- Clarify Docker concepts and container networking
- Debug configuration issues (NGINX, WordPress, MariaDB)
- Improve understanding of best practices in Dockerfiles and docker-compose