This repository contains Docker Compose and Dockerfile configurations for creating a containerized WordPress application with PHP 8.2 and Nginx. The Docker Compose file creates multiple containers for WordPress, MySQL, and Nginx, while the Dockerfile builds a single image that includes PHP, Nginx, and WordPress.
This Docker Compose file creates a container with PHP 8.2, Nginx, and WordPress. The wordpress container uses the official WordPress image and runs on the db container to access the MySQL database. The nginx container runs as a reverse proxy for the wordpress container, forwarding requests to port 8080 to the wordpress container.
Package |
Description |
WordPress |
An open-source software used for creating websites and blogs. WordPress is run in its own container. |
MySQL |
An open-source database used for storing WordPress data. MySQL is run in its own container. |
Nginx |
A web server and reverse proxy used to access WordPress via ports 80 and 443. |
Port |
Usage |
80 |
Used by Nginx to forward HTTP requests to the WordPress container. |
443 |
Used by Nginx to forward HTTPS requests to the WordPress container. |
8080 |
Used by the WordPress container to receive HTTP requests from Nginx and access the MySQL database. |
- Make sure Docker is installed on your computer.
- Download the Docker Compose file and save it in a directory on your computer.
- Open a terminal and navigate to the directory where you saved the Docker Compose file.
- Run
docker-compose up -d
to start the containers.
- Open your web browser and navigate to the address http://localhost to start WordPress.
- Follow the instructions to configure WordPress and create your blog or website.
This Dockerfile creates an image with PHP 8.2, Nginx, WordPress, and Node.js. The image also includes Composer for installing WordPress and an Nginx configuration file for running Nginx as a reverse proxy for PHP-FPM.
Package |
Description |
WordPress |
An open-source software used for creating websites and blogs. WordPress is run in its own container. |
MySQL |
An open-source database used for storing WordPress data. MySQL is run in its own container. |
Nginx |
A web server and reverse proxy used to access WordPress via ports 80 and 443. |
Node.js |
Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. |
Port |
Usage |
80 |
Used by Nginx to forward HTTP requests to the WordPress container. |
- Make sure Docker is installed on your computer.
- Download the Dockerfile and Nginx configuration file and save them in a directory on your computer.
- Open a terminal and navigate to the directory where you saved the Dockerfile and configuration file.
- Run
docker build -t my-wordpress .
to build the Docker image.
- Run
docker run -p 80:80 -d my-wordpress
to start the container.
- Open your web browser and navigate to the address http://localhost to start WordPress.
- Follow the instructions to configure WordPress and create your blog or website.