nginx映射文件服务器文件夹

普通用户A安装的nginx,yum源搭建文件服务器,新建普通用户B,其主目录是文件服务器需要访问的目录

普通用户A启动nginx无法访问B用户的文件服务器目录,提示403forbidden,权限不足

解决方案:

nginx的配置文件:nginx.conf将user ***   取消注释  并改成自己的文件服务器用户B      user  B;

重启nginx,但是报错:the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /opt/nginx/conf/nginx.conf:1

解决方案:

进入到nginx的sbin目录,执行以下命令:

所有用户都可以运行(因为是755权限,文件所有者:root,组所有者:root)

chown root:root nginx

chmod 755 nginx

执行完毕,root用户进行启动,启动成功,文件服务器目录也可以访问了~~~~

或者:

仅 root 用户和 B用户可以运行(因为是750权限,文件所有者:root,组所有者:B)

chown root:B nginx

chmod 750 nginx

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-20
  • 2021-06-28
  • 2022-12-23
  • 2022-02-07
  • 2021-03-31
  • 2021-11-14
猜你喜欢
  • 2021-11-15
  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
相关资源
相似解决方案