nginx autoindex接收403 Forbidden

我在使用Nginx和autoindex时遇到了麻烦.

即使我把它放在网站主机上,它仍然在扔“403-Forbidden at my”

     location /pics {
             autoindex on;              
     }

是我的配置

        server {

        listen   80;
        server_name www.domain.com;

        access_log /home/www/log/access.log;
        error_log /home/www/log/error.log;

        location / {

                    root   /home/www/public/;
                    index  index.html index.PHP;
                    }

        location    /pics {
                    autoindex on;
                     }
              }

我检查了Nginx -v并使用autoindex模块构建.
在这里变得无能为力.

最佳答案
位置/根目录中设置的根目录不适用于位置/图片,因此如果您检查错误日志,您会看到Nginx正在寻找/ pics请求的认根目录.只需删除位置/并在服务器上下文中设置root和index指令:

server {
  root /home/www/public;
  index index.html index.PHP;

  location /pics {
    autoindex on;
  }
}

相关文章

Nginx (engine x) 是一个高性能的HTTP和反向代理服务,也是一...
本地项目配置 1 复制 luffy/settings/dev.py为prop.py 修改l...
nginx不仅可以隐藏版本信息,还支持自定义web服务器信息 先看...
一 、此次漏洞分析 1 nginx HTTP/2漏洞 [nginx-announce] ng...
###进入nginx 目录cd /usr/local/nginx###递归显示 2 级目录...
在cmd命令窗口输入下面命令进行查看 tasklist /fi "ima...