douquanqiao6788 2016-08-10 12:02 采纳率: 100%
浏览 886
已采纳

Nginx将新文件www-data设置为所有者而不是我的用户

I have a question regarding file permissions. I created a new user with sudo, and set the directory to chown (username). So far so good, only now the situation: When the system (magento2) creates new files, or I upload via magento 2 new files, the owner is 'www-data' instead of magento2 username.

Question:

What Do I need to do that every new file that magento will create or the file that I upload via magento will get the owner as: magento2 instead of www-data?

Server:

Ubuntu 16.04 Nginx 1.10 PHP7

I created the user like this:

  1. adduser magento2
  2. usermod -aG sudo magento2

Then I chownd like this:

  1. sudo chown -R magento2:www-data /home/magento2

  2. sudo find /home/magento2 -type d -exec chmod g+s {} \;

Thanks in advance,

HRR

  • 写回答

1条回答 默认 最新

  • doumeng3080 2016-08-10 15:35
    关注

    The problem is that the user running the webserver will be the owner of the new files. As suggested by deckerch, you need to change the user who is running nginx.

    If you need to host multiple websites, you'll probably want different users to run nginx, so that every user will be able to create/access their files: https://www.digitalocean.com/community/tutorials/how-to-host-multiple-websites-securely-with-nginx-and-php-fpm-on-ubuntu-14-04

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作