Site icon Galgulee – 갈구리

Nginx HTTP AUTH

1. NGINX CONF

location “~^/html/.*” {
try_files $uri $uri/ =404;
auth_basic “Restricted Content”;
auth_basic_user_file /usr/local/nginx/conf/auth/.htpasswd;
}

2. 계정 파일 생성

# sudo htpasswd -c /usr/local/nginx/conf/auth/.htpasswd test_user
New password:
Re-type new password:
Adding password for user another_user

Exit mobile version