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 functions. You can pass the authbase account and password authentication provided by nginx. To achieve this, 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 Example analysis of adding account and password verification to nginx. For more information, please follow other related articles on the PHP Chinese website!