尝试访问 nginx 文档根目录中的文件夹时出现 403 禁止

use*_*502 5 mysql nginx centos php-fpm

当我访问 index.php 时,它工作正常。但是在 localhost/pset7 上,它给出了 403。

这是权限日志,

-rw-r--r--. 1 root        root          51 Jul 31 14:21 index.html
-rw-r--r--. 1 root        root          51 Jul 31 14:15 index.php
drwxrwxr-x. 5 my_user my_user 4096 Jul 31 15:13 pset7
Run Code Online (Sandbox Code Playgroud)

我需要在网络服务器上运行它,所以请告诉我如何设置正确的权限并解决这个问题。

在 CentOS 上使用 LEMP。

如果您需要任何其他信息/日志,请询问。

Edit1, nginx 配置 - http://pastebin.com/K3fcWgec

谢谢。

use*_*951 0

您看到此情况的原因是“pset7”未添加到 Nginx 配置中。您需要做的就是将以下内容添加到您的 Nginx 配置中

    location /pset7 {
    root   /var/www/html; # Put this somewhere else, probably in the beginning of your config instead of here, if possible.
    index  index.html index.htm index.php;
}
Run Code Online (Sandbox Code Playgroud)