nginx password 验证

sunny Nginx215,7665字数 336阅读1分7秒阅读模式

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/

weinxin
我的微信
微信公众号
扫一扫关注运维生存时间公众号,获取最新技术文章~
sunny
  • 本文由 发表于 29/10/2015 01:00:00
  • 转载请务必保留本文链接:https://www.ttlsa.com/nginx/how-to-set-up-password-authentication-with-nginx/
评论  2  访客  2
    • 明月登楼
      明月登楼 1

      这个号,感觉很高效!openssl基本上哪个Linux发行版都有的!

      • byg
        byg 9

        这个配置要怎么写

      评论已关闭!