压在透明的玻璃上c-国产精品国产一级A片精品免费-国产精品视频网-成人黄网站18秘 免费看|www.tcsft.com

nginx基于htpasswd安全驗證

  工作原因,需要對一個服務做做安全驗證,基于nginx負載:

  nginx基于htpasswd安全驗證

  在nginx 做安全驗證,在nginx.conf中server標簽下添加如下:

  auth_basic "Authorized Login1111";

  auth_basic_user_file /opt/nginx/conf/htpasswd;

  也可以做location 匹配,依照個人需求

  location / {

  auth_basic "Authorized Login1111";

  auth_basic_user_file /opt/nginx/conf/htpasswd;

  }

  然后使用htpasswd生成用戶和密碼(密文)

  /usr/bin/htpasswd -c /opt/nginx/conf/htpasswd user

  New password: ***

  Re-type new password: ***

  cat   /opt/nginx/conf/htpasswd user

  user:pwYOfUEu2Zrls

  如果沒有htpasswd可以使用類似命令來操作

  a=`perl -e 'print crypt($ARGV[0], "pwdsalt")'  123456`

  echo "user:$a" >/opt/nginx/conf/htpasswd

  cat   /opt/nginx/conf/htpasswd user

  user:pwy1aR9NQZei6

  也可以寫成小腳本使用

 

上一篇:安卓防火墻 PS DroidWall

下一篇:BYOD安全保護的“原生態”方法