httpd.confで以下の項目追加
<Directory "/opt/awstats/wwwroot"> <-認証をかけたいディレクトリ AuthType Basic AuthName "Awstats Secret Zone" AuthUserFile /etc/httpd/conf/.htpasswd Require user hogehogehoge <-ユーザ名 </Directory>
以下のコマンドを実行
[root@www conf]# htpasswd -c /etc/httpd/conf/.htpasswd hogehogehoge New password: Re-type new password: Adding password for user hogehogehoge [root@www conf]#
ちなみにオプションの-cは上書きですね。上書きしないで追加の場合は何もオプションをつけなくてよいです。
Digest認証を行う場合は、
<Location "/framework"> <-URLのパスでもいい AuthType Digest AuthName "Subversion repository" AuthUserFile /var/www/conf/.htdigest Require valid-user <-こうかくと、認証されたユーザはOKとなる </Location>
として以下のコマンドを実行します。
htdigest -c /etc/httpd/conf/.htdigest 'Subversion repository' hogehogehoge
引数の'Subversion repository'はAuthName?にあわせる必要があるようです。
この記事は
現在のアクセス:11048