nginx用戶認證配置( Basic HTTP authentication)

  • 生成密碼
$ htpasswd /file/conf/passwd <username>
  • 配置
location / {
    auth_basic "File server login (size 6)"; 
    auth_basic_user_file /file/conf/passwd;

    autoindex on;
    autoindex_exact_size on;
    autoindex_localtime on;
}
發佈了27 篇原創文章 · 獲贊 7 · 訪問量 9萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章