Bashing my head against a wall for hours here, i can't upload files in wordpress due to permission denied, i have logged into the website container and tried different users with chown like www-data, nginx, 1000 and all chmod to 755 yet i still can't upload files.
Wordpress clearly can see the uploads folder as it says:
The uploaded file could not be moved to wp-content/uploads/2022/05.
so it's looking at the correct location and seeing the 05 folder but just can't write the file to it. I'm using a docker volume for the uploads folder which is mapped to the container wp-content/uploads path. When i log into the container i can see the files that are stored on the volume, just can't write to it.
If it helps here is an output on the website container of the uploads folder:
-rw-rw-r-- 1 1000 1000 1878 May 2 12:29 db-error.php
-rw-rw-r-- 1 1000 1000 0 May 2 17:50 debug.log
-rw-rw-r-- 1 1000 1000 28 May 2 12:29 index.php
drwxrwxr-x 4 1000 1000 4096 May 3 10:24 languages
-rw-rw-r-- 1 1000 1000 21758 May 2 12:29 object-cache.php
drwxrwxr-x 18 1000 1000 4096 May 3 11:01 plugins
drwxrwxr-x 6 1000 1000 4096 May 3 10:25 themes
drwxrwxr-x 10 1000 1000 4096 May 3 12:36 uploads
I have tried to chmod the uploads folder to nginx, www-data and it just won't work and i'm now at a loss.
Here is the docker compose:
version: '3.7'
services:
rhino-php:
platform: linux/amd64
build:
context: ./docker
dockerfile: Dockerfile-php7.4
image: rhino-php
container_name: rhino-php
volumes:
- ./Vipirs-Website:/usr/share/nginx/html
ports:
- 9000
networks:
- vipirs-net
rhino-proxy:
platform: linux/amd64
image: nginx:alpine
container_name: rhino-proxy
depends_on:
- vipirs-website
volumes:
- ./docker/nginx/proxy-live.conf:/etc/nginx/nginx.conf
- /usr/local/share/sites/vipirs.com/docker/ssl/live:/usr/local/etc/ssl/certs
ports:
- 80:80
- 443:443
networks:
- vipirs-net
vipirs-website:
platform: linux/amd64
image: nginx
container_name: vipirs-website
depends_on:
- rhino-php
- vipirs-website-database
volumes:
- ./docker/nginx/site-live.conf:/etc/nginx/conf.d/default.conf
- ./Vipirs-Website:/usr/share/nginx/html
- ./Vipirs-Website/logs/wp-debug.log:/usr/share/nginx/html/website/wp-content/debug.log
- vipirs-uploads:/usr/share/nginx/html/website/wp-content/uploads:rw
- /usr/local/share/sites/vipirs.com/docker/ssl/live:/usr/local/etc/ssl/certs
ports:
- 80
- 443
links:
- rhino-php
networks:
- vipirs-net
vipirs-website-database:
platform: linux/amd64
image: mysql:5.7
container_name: vipirs-db
environment:
MYSQL_ROOT_PASSWORD: vipirs
MYSQL_DATABASE: vipirs
MYSQL_USER: vipirs
MYSQL_PASSWORD: vipirs
volumes:
- ./Vipirs-Website/db:/usr/share/db
- vipirs-db:/var/lib/mysql
restart: always
ports:
- 3306
networks:
- vipirs-net
networks:
vipirs-net:
volumes:
vipirs-uploads:
vipirs-db:
Weirdly if i also try to use a bind mount it still won't write to it.
Bashing my head against a wall for hours here, i can't upload files in wordpress due to permission denied, i have logged into the website container and tried different users with chown like www-data, nginx, 1000 and all chmod to 755 yet i still can't upload files.
Wordpress clearly can see the uploads folder as it says:
The uploaded file could not be moved to wp-content/uploads/2022/05.
so it's looking at the correct location and seeing the 05 folder but just can't write the file to it. I'm using a docker volume for the uploads folder which is mapped to the container wp-content/uploads path. When i log into the container i can see the files that are stored on the volume, just can't write to it.
If it helps here is an output on the website container of the uploads folder:
I have tried to chmod the uploads folder to nginx, www-data and it just won't work and i'm now at a loss.
Here is the docker compose:
Weirdly if i also try to use a bind mount it still won't write to it.