Place the following two entries in nginx configuration file:
auth_basic "Restricted";
auth_basic_user_file /var/www/mywebsite.com/.htpasswd;
Eg:
location / {
root /var/www/mywebsite.com;
index index.html index.htm;
auth_basic "Restricted"; #For Basic Auth
auth_basic_user_file /var/www/mywebsite.com/.htpasswd; #For Basic Auth
}
The .htpasswd must contain:
username:password
Generate the password with this command:
[root@IBM ~]#printf "USERNAME:$(openssl passwd -crypt PASSWORD)\n" >> htpasswd
[ view entry ] ( 1468 views ) | print article
<<First <Back | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Next> Last>>