首页 > 解决方案 > 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.

标签: wordpressnginx

解决方案


当使用数字海洋水滴时,您可能会使用 sftp 访问您的服务器。

登录后在终端中尝试以下命令。

  1. 将您当前登录的用户添加到 www-data 组:

    sudo usermod -aG www-data $USER

  2. 然后将您的虚拟主机目录以及所有文件和子目录更改为由 www-data 组拥有:

    sudo chown -R www-data:www-data /var/www

  3. 设置适当的权限,以便您可以通过 sftp 上传文件、通过命令行管理文件以及直接在 WordPress 中上传插件和媒体:

    sudo chmod -R 774 /var/www

希望这可以帮助

萨斯基亚


推荐阅读