關於Nginx 403 forbidden 錯誤踩的坑 directory index of "/xx/xx/xx/" is forbidden


今天,在玩一個Nginx服務器,准備分享某個目錄盤。當FTP玩的時候

 

 

不同的是增加了2個參數

    server {
        listen xxx;
        server_name xxx.test.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.x/22;  # 限制IP段登陸
        deny all;
    }

 

除了以上情況,還有403錯誤。需要排查的思路

1. selinux

2. 目錄下有沒有index.html 文件(如果有就需要配套有 index  index.html  )

3. 權限問題

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM