微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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;
  }
}

原文地址:https://www.jb51.cc/nginx/435709.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐