今天,在玩一個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. 權限問題