Module ngx_http_auth_basic_module

Module ngx_http_auth_basic_module The ngx_http_auth_basic_module module allows limiting access to resources by validating the user name and password using the “HTTP Basic Authentication” protocol. Access can also be limited by address, by the result of

nginx.org

 

  • ngx_http_auth_basic_module 모듈은 "HTTP Basic Authentication" 프로토콜을 사용하여 user name과 password를 검증함으로써 리소스에 대한 접근을 제한 가능
  • 주소(address), subrequest의 결과 또는 JWT에 의해 액세스를 제한
  • 주소(address)와 비밀번호(password)에 의한 접근 제한을 동시에 적용하려면 satisfy 지시어로 제어

auth_basic 지시자

  • “HTTP Basic Authentication” 프로토콜을 사용하여 user name과 password 의 유효성 검사를 활성화 
  • 지정된 매개변수는 영역(realm)으로 사용
  • off는 configuration level에서 상속된 auth_basic 지시어의 효과를 취소

  • 문맥 : http, server, location, limit_except
  • 사용 문법 
  • ## 문법 auth_basic string | off;
  • 사용 예시
    ## 기본 설정
    auth_basic off;

 

auth_basic_user_file 지시자

  • user name과 password를 저장하는 파일을 지정
  • 파일 이름에는 변수를 포함 가능
    # comment
    name1:password1
    name2:password2:comment
    name3:password3
     
  • 아래와 같은 password 유형이 지원
    1. crypt() 함수로 암호화된 비밀번호 → Apache HTTP Server의 htpasswd나 openssl passwd 명령어로 생성 가능
    2. Apache 버전의 MD5 기반 비밀번호 알고리즘(apr1)으로 해시된 비밀번호 → Apache HTTP Server의 htpasswd openssl passwd 명령어로 생성 가능
    3. RFC 2307에 설명된 대로 “{scheme}data” 구문으로 지정 → 구현된 스키마에는 PLAIN, SHA(SHA-1 hashing, 추천 X) 및 SSHA(salted SHA-1 hashing, 일부 소프트웨어 패키지, 특히 OpenLDAP 및 Dovecot에서 사용)
 
  • 문맥 : http, server, location, limit_except
  • 사용문법
    ## 기본 설정
    auth_basic_user_file file;

 

'Nginx > Nginx 모듈 학습' 카테고리의 다른 글

ngx_http_v2_module 모듈  (0) 2025.01.18
ngx_http_autoindex_module 모듈  (0) 2024.12.15
ngx_http_dav_module 모듈  (1) 2024.12.11
ngx_http_hls_module 모듈  (0) 2023.09.24
ngx_http_mp4_module 모듈  (0) 2023.09.24

+ Recent posts