I am running a Wordpress instance in a docker container behind and Nginx proxy. I use docker compose to deploy / update the application. This is hosted in AWS on linux box with the 2023 AWS Linux AMI.
I have a bind mount configured for the wp-content and .htaccess file. The .htaccess file is necessary because the W3 Total Cache plugin will make modifications to this file and flushing the permalinks will regenerate it.
I cannot seem to get the permissions correct on the bind mount to allow the W3 Total Cache plugin to modify the .htaccess file.
Once the container is deployed / and started I run a script
chmod -R 777 /shared/wordpress/
chown -R ec2-user:ec2-user /shared/wordpress/
docker exec $(containerName) wp plugin activate --all
docker exec $(containerName) wp rewrite flush --hard
The docker compose volumes are:
volumes:
- /shared/wordpres/wp-config.php:/var/www/html/wp-config.php
- /shared/wordpress/wp-content:/var/www/html/wp-content:rw
- /shared/wordpress/.htaccess:/var/www/html/.htaccess:rw
This configuration should give the container permission to read / write to the .htaccess file - but I keep getting a plugin error on the W3 Total Cache dashboard:
