The configuration is as follows:
server {
listen 8085;
root /data/nginx/domain6;
server_name www.c.com;
charset utf-8;
location / {
root /data/nginx/domain6;
}
location ~* /images/ {
root /data/nginx/domain6;
auth_basic "Private Zone";
auth_basic_user_file /data/nginx/domain6/ssl/.htpasswd;
autoindex on;
}
}
Use the command to prepare the .htpasswd file
htpasswd -cmb .htpasswd username password
-c is used when creating a new .htpasswd, add
htpasswd -mb .htpasswd username2 password2
Access
user authentication input settings pop-up box, and a password.