Chinaunix首页 | 论坛 | 博客
  • 博客访问: 210574
  • 博文数量: 39
  • 博客积分: 1949
  • 博客等级: 上尉
  • 技术积分: 347
  • 用 户 组: 普通用户
  • 注册时间: 2010-09-24 16:24
文章分类

全部博文(39)

文章存档

2013年(1)

2012年(12)

2011年(24)

2010年(2)

分类: 系统运维

2012-06-23 15:33:02

nginx 访问密码校验

nginx server配置

  1. server {
  2. listen 80;
  3. server_name 10.0.0.1;
  4. root /tmp;
  5. location / {
  6. add_header Cache-Control max-age=300;
  7. auth_basic "PASSWD";
  8. auth_basic_user_file htpasswd;
  9. }
  10. }

在配置文件当前目录下 建个htpasswd文件,内容格式如下,其中passwd需加密的

  1. user:passwd

passwd加密脚本,

  1. #!/usr/bin/perl
  2. use strict;

  3. my $pw=$ARGV[0];
  4. print crypt($pw,$pw)."\n";

完成后,访问就需输入页面密码了


阅读(2313) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~