Example analysis of adding account and password verification to nginx

WBOY
Release: 2023-06-03 09:28:22
forward
736 people have browsed it

nginx adds account and password verification

server {
 location / {
 auth_basic "please input user&passwd";
 auth_basic_user_file key/auth.key;
 }
}
Copy after login

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";
Copy after login

Usage:

# perl pwd.pl ops-coffee.cn
opf8BImqCAXww
# echo "admin:opf8BImqCAXww" > key/auth.key
Copy after login

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!