This Docker Compose configuration provides a setup for running WordPress,PHP-fpm MySQL, Nginx, and PHPMyAdmin using Docker containers.
Build for easy development and production setups, also possible to use in production with some tweaks.
- mysql:8.0
- nginx:1.25.3-alpine
- wordpress:6.4.3-php8.1-fpm-alpine
- phpmyadmin:5.2.1
db
: MySQLwordpress
: Wordpressnginx
: NGINX Proxy Serverphpmyadmin
: NGINX Proxy Server
-
Clone this repository:
git clone https://github.com/kozmozio/docker-wordpress.git cd your-repository
-
Create a
.env
file with the required environment variables:NAMESPACE=your_project_name MYSQL_DATABASE=your_db_name MYSQL_ROOT_PASSWORD=your_root_password MYSQL_USER=your_db_user MYSQL_PASSWORD=your_db_password WORDPRESS_DB_HOST=db WORDPRESS_DB_USER=your_wp_user WORDPRESS_DB_PASSWORD=your_wp_password WORDPRESS_DB_NAME=your_wp_db_name WORDPRESS_DEBUG=true WORDPRESS_TABLE_PREFIX=wp_ # WP_DEBUG=debug
-
bash build-dev.sh
file is a shortcutdocker build -f Dockerfile -t kozmozio/wordpress:6.4.3 -t kozmozio/wordpress:6.4.3 . --no-cache
-
Push to Dockker Hub (optional)
docker tag kozmozio/wordpress:6.4.3 kozmozio/wordpress:6.4.3
docker push kozmozio/wordpress:6.4.3
-
Docker Compose UP!
docker-compose.yml
file is used to define, configure, and run multi-container Docker applications.docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.yml up -d
-
Access WordPress:
- Add your domain to your hosts file via terminal
sudo pico etc hosts
- Add :
127.0.0.1 docker-wp.local
- Open your browser and navigate to http://docker-wp.local
- Add your domain to your hosts file via terminal
-
Access PHPMyAdmin:
- Open your browser and navigate to http://localhost:8000
- Use the MySQL credentials specified in the
.env
file.
-
.env-sample:
- Name it to
.env
and save in project root.
- Name it to
-
Nginx Configuration:
- Nginx configuration can be customized by modifying
./docker/nginx.conf
.
- Nginx configuration can be customized by modifying
-
Dockerfile:
- Customise your hosting environment config and defaults
-
docker-compose.yml:
`volumes: - ./wordpress:/var/www/html - ./themes/twentytwentyfour:/var/www/html/wp-content/themes/twentytwentyfour - ./plugins:/var/www/html/wp-content/plugins - ./uploads:/var/www/html/wp-content/uploads`
db
: MySQLwordpress
: Wordpressnginx
: NGINX Proxy Serverphpmyadmin
: NGINX Proxy Server
## Networks
docker-wp-net
: This is a custom network created for the services in this Docker Compose configuration. It uses thebridge
driver, which is the default network driver for Docker. If you connect any services to this network, they will be able to communicate with each other.
To start the application, navigate to the directory containing this file and run:
bash build-dev.sh
- If you encounter issues, check the logs:
docker-compose logs -f
You are a devops engineer, tou task is to make live production ready wordpress website inside ddokcer php-fpm enviroment, mysql database and nginx proxy server , hosted in Hestia control panel under another nginx server.
Currently containers are up and running but SSL is not workikng