Setting Correct Permission For WordPress Using trafex/php-nginx

Overview

So recently, I moved from DigitalOcean to Hetzner. While the move is from a Debian VPS to another VPS but there was a big change, my new host is an arm host and the old, awesome webdevops/php-nginx doesn’t support arm platform.

So I tried https://hub.docker.com/r/trafex/php-nginx and the site was up great after initial configuration. However, I got issues that sitemap.xml could not be generated and I cannot plugins. I know this is a file permission issue.

With the help of Gemini, I was able to bring the site to normal state again.

Setting correct file permisions

First, exec to the docker container with root privilege

# Exec into the container:
docker exec -it -u 0 datmt_wp sh

# Correct the permissions
chown -R nobody:nobody /var/www/html
find /var/www/html -type d -exec chmod 755 {} \;
find /var/www/html -type f -exec chmod 644 {} \;

Now I can update plugins and have my sitemap.xml again!

Leave a Comment