nginx adds account and password verification
server { location / { auth_basic "please input user&passwd"; auth_basic_user_file key/auth.key; } }
There are many services accessed through nginx, but they do not provide account authentication. This can be achieved through the authbase account and password authentication provided by nginx. You can use the following script to generate the account password
# cat pwd.pl #!/usr/bin/perl use strict; my $pw=$ARGV[0] ; print crypt($pw,$pw)."\n";
Usage:
# perl pwd.pl ops-coffee.cn opf8BImqCAXww # echo "admin:opf8BImqCAXww" > key/auth.key
The above is the detailed content of How to add account and password verification in nginx. For more information, please follow other related articles on the PHP Chinese website!