wordpress - Nginx permissions with wordpress
问题描述
I am trying to set up wordpress on digitalocean with nginx. I am running into permissions issues though. When I upload a file or try to install a plugin I get the cannot create in directory warning. So I came across the post Here that says I need to give nginx access to the folder. So I executed the following:
sudo chown -R www-data:www-data /path/to/folder
sudo chmod -R 755 /path/to/folder
This works except now I cannot add and delete files with filezilla. Obviously because the permissions to the folder are no longer with the me the user they are now with www-data.
So my question is what is the correct way to configure nginx to work with wordpress and still allow me to upload and delete files with ftp.
解决方案
当使用数字海洋水滴时,您可能会使用 sftp 访问您的服务器。
登录后在终端中尝试以下命令。
将您当前登录的用户添加到 www-data 组:
sudo usermod -aG www-data $USER
然后将您的虚拟主机目录以及所有文件和子目录更改为由 www-data 组拥有:
sudo chown -R www-data:www-data /var/www
设置适当的权限,以便您可以通过 sftp 上传文件、通过命令行管理文件以及直接在 WordPress 中上传插件和媒体:
sudo chmod -R 774 /var/www
希望这可以帮助
萨斯基亚
推荐阅读
- android - 存储要对对象打开的活动
- firebase - 使用数组还是子集合?
- scale - 如何在保持垂直笔划宽度相同(并且不改变任何水平尺寸)的同时垂直缩小字形?
- python - 二叉树如何在水中工作?
- html - 如何使用 css 网格构建 Web 模板,使其成为这样?
- firebase - 可重新排序的大型数组的最佳 NoSQL 服务器结构
- assembly - RISC-V ISA 中的任何假设阻止堆栈增长而不是下降?
- javascript - 有没有办法在 Node REPL 中获取函数的签名/文档?
- ios - 无法使用开发者帐户在真实设备上安装 WebDriverAgent
- c - 使用指针递归