A Docker based project for WordPress theme and plugin development utilizing MariaDB and NGINX.
WordPress
:5.4.1
PHP
: php7.4-fpm-alpine
MariaDB
: 10.5.2
NGINX
: 1.17.7-alpine
git clone https://github.com/amirmasoud/coir.git
cd coir
docker-compose up -d
Open localhost on default port, 80.
docker-compose stop
docker-compose down -v
.env
file you have to restart containers for changes to take effect.
After running docker-compose up -d
your WordPress files to be copied to wordpress
directory. navigate to that directory. the rest is history.
- Set
WORDPRESS_DEBUG
to an empty values - Restart containers
You can upgrade our downgrade to your desired version by stoping containers first, editing .env
file and start your containers again.
For example, if you want to use php
: 7.2 instead of 7.4 you should:
- change
WORDPRESS_VERSION
in.env
to5.4.1-php7.2-fpm
- run
docker-compose up -d
to pull the new WordPress image.
fpm
versions are supported in this project.
- Open
deploy/conf.d/coir.conf
- Change
server_name
to your domain. - Restart your containers for changes to take effect.
.test
domain you should also append 127.0.0.1 yourcustomdomain.test
to /etc/hosts
file on Mac or c:\Windows\System32\Drivers\etc\hosts
file on Windows. (You may need root access on Mac or administrator privileges on Windows to perform this step)
in .env
, following credentials are corresponding to database credentials:
DATABASE_USER
: database username that WordPress is using.
DATABASE_PASSWORD
: database username that WordPress is using.
DATABASE_NAME
: name of the database that WordPress is using.
DATABASE_ROOT
: database root password which WordPress is NOT using it.
SSH into WordPress container:
docker-compose exec wordpress bash
SSH into database (MariaDB) container:
as root: following command will ask for your root database password (DATABASE_ROOT
variable in .env
)
docker-compose exec database mysql --password
as non-root: It will ask for you non-root database password (DATABASE_PASSWORD
variable in .env
). Change --user
value if you have changed the user in .env
docker-compose exec database mysql --user=coir --password
SSH into proxy (NGINX) container:
docker-compose exec proxy sh
Change deploy/wordpress/uploads.ini
parameters value to modify upload limits. (Default upload_max_filesize
is 64M)
Also change client_max_body_size
(in server and location) in deploy/proxy/conf.d/coir.conf
.
Try followig solutions:
- Run
docker-compose exec wordpress chown -R www-data:www-data /var/www/html/wp-content
to fix directory permissions. - add
define( 'FS_METHOD', 'direct' );
towp-config.php
Navigate to deploy/proxy/logs
and you can check access.log
and error.log
files.
|.env # Coir config
|docker-compose.yml # docker compose
|-wordpress # WordPress files
|-deploy
| |-database # MariaDB
| |-proxy # NGINX
| | |-logs # error.log & access.log
| | |-conf.d # .conf
If you found any issue or have any ideas to enhance the project please do not hesitate to open an issue.
If you found this repository useful please consider starring the project.