Simplify your WordPress development using Docker and Docker Compose.
With this repository, you can benefit from the features of the following tools to enhance your WordPress site’s performance and security:
Content:
-
Make sure you have the latest version of Docker Engine; to do so, you can follow the instructions in the link below:
Install Docker Engine -
Check that ports
80and443are exposed and available for use. -
Update DB root password
echo "your_password" >secrets/db_root_password.txtClone this GitHub repository to your local machine:
git clone https://github.com/jsdiazp/wordpress-docker-compose.gitNavigate to the repository folder:
cd wordpress-docker-composeEdit wordpress-*.conf file from the nginx/conf.d folder replacing the server_name attribute with your website domain and aliases.
Run the docker compose command to start the containers:
docker compose up -dTo enable HTTPS and get an SSL certificate for your site, run the following command and follow the instructions displayed:
docker compose exec -ti nginx certbotNote: Make sure that the DNS A record for the domain and subdomains specified in the nginx server_name attribute point to the public IP of the server on which you have installed this container orchestration.
Install the Wordfence Security plugin on your WordPress site.
Enable the Wordfence firewall by uncommenting the following line in the wordpress-*.ini file from the wordpress/php folder.
# auto_prepend_file = '/var/www/html/wordfence-waf.php'Finally, restart the Docker Compose project.
docker compose restartdocker compose exec -ti db mariadb -u root --password="$(<secrets/db_root_password.txt)"