nginx 配置验证非常简单,这里就不累述了,看博主前面的nginx系列文章。
这里说说如何生成password文件。其它方法就不说了,主要说使用openssl来生成。文章源自运维生存时间-https://www.ttlsa.com/nginx/how-to-set-up-password-authentication-with-nginx/
1. 添加一个用户
添加用户ttlsa文章源自运维生存时间-https://www.ttlsa.com/nginx/how-to-set-up-password-authentication-with-nginx/
# echo -n 'ttlsa:' >> /usr/local/nginx/conf/passwd
2. 设置加密密码
为ttlsa用户密码设置为www.ttlsa.com文章源自运维生存时间-https://www.ttlsa.com/nginx/how-to-set-up-password-authentication-with-nginx/
# openssl passwd www.ttlsa.com >> /usr/local/nginx/conf/passwd
3. 查看
# cat /usr/local/nginx/conf/passwd ttlsa:I5OG.QXtiqFJs
其它方式,如htpasswd命令,就不说了,这个工具是由apache2-utils包提供的。文章源自运维生存时间-https://www.ttlsa.com/nginx/how-to-set-up-password-authentication-with-nginx/ 文章源自运维生存时间-https://www.ttlsa.com/nginx/how-to-set-up-password-authentication-with-nginx/

我的微信
微信公众号
扫一扫关注运维生存时间公众号,获取最新技术文章~
2F
这个号,感觉很高效!openssl基本上哪个Linux发行版都有的!
1F
这个配置要怎么写