nginx映射文件服务器文件夹

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

原文地址:https://www.cnblogs.com/qingqing74647464/p/9435582.html