配置apache让用户登录

安装配置svn时得到了启发,当用户访问某页面时,如果要让用户输入用户名和密码,可以配置如下:

<Location /XXX>
  AuthType Basic
  AuthName "AUTH NAME"
  AuthUserFile /etc/auth-file
  Require valid-user
</Location>

auth-file可以通过htpasswd生成, 也可以通过这个命令增加用户:

htpasswd -cm /etc/svn-auth-file gene

htpasswd -m /etc/svn-auth-file pgj

我的svn在httpd.conf里的配置如下:

<Location /svn>
  DAV svn
  SVNPath /var/svn
  AuthType Basic
  AuthName "Subversion repository"
  AuthUserFile /etc/svn-auth-file
  Require valid-user
</Location>

1 thought on “配置apache让用户登录”

  1. Sweet blog! I found it while searching on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Cheers

Comments are closed.