小编Rug*_*ggs的帖子

使用 nginx 和 nfs 拒绝权限

我有两台 RHEL 7 机器。

我已经安装了 nginx 和 php-fpm 并设置了 nfs 安装。我可以毫无问题地读/写 nfs 挂载,并且我有另一个能够对其进行读写的应用程序服务器 (Apache Geronimo)。

当我安装 nginx 时,它会设置一个我在 NFS 文件服务器上创建的 nginx 用户,该用户具有相同的 uid 和 gid。

我可以使用 nginx 用户列出 nfs 客户端挂载上的文件。但是,当我尝试使用 nfs 中的 nginx 提供静态 html 或动态 php 文件时,出现权限错误:

*5 stat() "/usr/depot/repository/test.php" failed (13: Permission denied)
*5 open() "/usr/depot/repository/test.html" failed (13: Permission denied)
Run Code Online (Sandbox Code Playgroud)

此外,我在 /usr/depot/testing 下创建了具有相同权限的文件夹(只是不是 nfs),并且效果很好。

这是客户端上的安装信息。

xxx.xxx.xxx.xxx:/mnt/repository on /usr/depot/repository type nfs4 (rw,nosuid,nodev,noexec,relatime,vers=4.0,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=xxx.xxx.xxx.xxx,local_lock=none,addr=xxx.xxx.xxx.xxx)
Run Code Online (Sandbox Code Playgroud)

我看不出这个设置有什么问题,所以我不知道为什么 nginx 无法从 nfs 共享中读取文件。

更新

好的,我刚刚禁用了 SELinux 重启并修复了它。现在的问题是如何配置 SELinux 以便 nginx 可以访问远程服务器。

nginx nfs nfs4

2
推荐指数
1
解决办法
3516
查看次数

标签 统计

nfs ×1

nfs4 ×1

nginx ×1