今天,在做一个Nginx分享服务器某个目录盘。
不同的是增加了2个参数
server {
listen
xxx
;
server_name down.cdbaidu.com;
location / {
root /Downloads/Dokcers/b1/downloads;
autoindex on; # <----罪魁祸首,添加这个以后不再出现403错误
#index index.php index.html;
# auth
auth_basic "Please input B1 password"; # 设置加密登陆的提示
auth_basic_user_file /etc/nginx/xxx/.htpasswd; # 设置加密的账号密码文件
}
# log
access_log /Downloads/Dokcers/b1/web/access.log;
error_log /Downloads/Dokcers/b1/web/error.log info; # 打开这个模式有注意排错
# IP access
allow 192.168.x.0/22; # 限制IP段登陆
deny all;
}
除了以上情况,还有403错误。需要排查的思路
1. selinux
2. 目录下有没有index.html 文件(如果有就需要配套有 index index.html )
3. 权限问题
关于Nginx 403 forbidden 错误踩的坑 directory index of "/xx/xx/xx/" is forbidden
原文:https://www.cnblogs.com/Cong0ks/p/11958846.html
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!