问题描述
之前用Docker/Docker compose搭建了wordpress,并把数据wp-content和数据库也迁移到了docker版本的wordpress,发现有问题,就是无法上传图片附件,提示:
无法将上传的文件移动至wp-content/uploads/2021/12/18
尝试修改主机的wp-content权限为777无效,后来到了docker里面的wordpress修改wp-content的owner解决问题
docker ps 查看主机下的wordpress的containerID
[root@wulala ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9fecbf5a816b wordpress:latest "docker-entrypoint.s…" 2 days ago Up 2 days 0.0.0.0:8000->80/tcp, :::8000->80/tcp opt_wordpress_1 e8e0c8f0e5cf mysql:5.7 "docker-entrypoint.s…" 2 days ago Up 2 days 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp opt_db_1
进入wordpress的bash
[root@wulala ~]# docker exec -it 9fecbf5a816b /bin/bash root@9fecbf5a816b:/var/www/html#
修改wp-content的owner:
root@9fecbf5a816b:/var/www/html# chown -R www-data:www-data /var/www/html/wp-content/
文章评论