Easy Wordpress setup using docker
Before you proceed, ensure you have docker
and docker-compose
installed.
- Follow docker installation steps to install
docker
- Follow docker-compose installation steps to install
docker-compose
These steps will install MySQL, Wordpress, Nginx and Certbot for automatic SSL certificate issuance and renewal
-
Close this repo into a directory of your choice,
git clone https://github.com/dannysofftie/docker-wordpress.git
-
Open
docker-compose.yml
in your editor, and change below line to match your email and domain namecertonly --webroot --webroot-path=/var/www/html --email info@example.com --agree-tos --no-eff-email --force-renewal -d blog.example.com -d blog.example.com
-
Open
nginx.conf
innginx-conf
directory, and change all instances ofblog.example.com
to your domain. -
Run
docker-compose up -d
, then wait for about 2 minutes for MySQL to boot up, -
At this point, we need to make some changes to the wordpress docker image to allow uploading and editing theme files.
-
Run
docker exec -it wordpress bash
to access wordpress image shell, -
Open
wp-config.php
innano
orvim
, -
Add
define( 'FS_METHOD', 'direct' )
at the bottom of the file and save it, -
Change ownership of wordpress installation directory to allow making file modifications
chmod -R www-data:www-data /var/www
-
-
Exit the shell with the command
exit
-
Shut down your containers and restart to effect above changes
docker-compose down && docker-compose up -d
-
Now open
your-server-ip:3400
oryour-domain.com
on a browser to access your wordpress website and to set it up.