我们需要将它修改为如下内容:

    <VirtualHost *:80>
    ServerAdmin webmaster@localhost
    #DocumentRoot /var/www
    DocumentRoot /srv/tftp
    <Directory />
    Options FollowSymLinks Indexes
    AllowOverride All
    <limit GET POST OPTIONS PROPFIND>
    Order allow,deny
    Allow from all
    </Limit>
    </Directory>
    #<Directory /var/www/>
    #<Directory /var/www/>
    #Options Indexes FollowSymLinks MultiViews
    #AllowOverride None
    #Order allow,deny
    #allow from all
    #</Directory>
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>

  使用vi命令编辑/srv/tftp/.htaccess文件,命令模式如下:

root@AkBirdofpreyWorkStation:/# vi /srv/tftp/.htaccess

  文件内容如下:

  AuthUserFile /etc/secure.user  ##用户帐号密码文件名

  AuthName akcwdCA   用户登录认证信息提示

  AuthType Basic

    <Limit GET>
    require valid-user
    </Limit>

  使用htpasswd -c /etc/secure.user建立用户密码文件,命令模式如下:

root@AkBirdofpreyWorkStation:/# htpasswd -c /etc/secure.user user1

  程序会提示你输入两次用户的口令,然后用户密码文件已经创建,user1这个用户也同时创建完成了。

  使用命令/etc/init.d/apache2 restart重启apache服务器,命令模式如下:

    root@AkBirdofpreyWorkStation:/# /etc/init.d/apache2 restart
    [....] Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.1.253 for ServerName
    ... waiting .apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.1.253 for ServerName
    . ok