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.gitcd coirdocker-compose up -d
Open localhost on default port, 80.
docker-compose stopdocker-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_DEBUGto 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_VERSIONin.envto5.4.1-php7.2-fpm - run
docker-compose up -dto pull the new WordPress image.
fpm versions are supported in this project.
- Open
deploy/conf.d/coir.conf - Change
server_nameto 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 bashSSH 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 --passwordas 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 --passwordSSH into proxy (NGINX) container:
docker-compose exec proxy shChange 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-contentto 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 # .confIf 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.