ラベル

Server (108) work (77) Idea (68) Car (31) PC (29) DAW (28) other (19) MakingWEBsite (18) 趣味 (18) health (13) CentOS (11) drupal (11) 山 (9) android (4) スマホ (4) communication (3) drupal7 (3) hint (3) meno (3) モバイル (3) 歯医者 (3) 第二種電気工事士 (3) 英語 (3) PC Server (2) drupal8 (2) ms access (2) uwp C# (2) めし (2) 整備 (2) 音楽 (2) MIDI (1) diy (1) 会計 (1) 動画再生 (1) 生活 (1) 郵便 (1) 食べ物 (1)

2014年9月1日月曜日

centos apache httpd.conf Directory 設定 2 Basic認証

basic認証。

/etc/httpd/conf/に作った.htpasswdファイルの内容を
/etc/httpd/conf/httpd.conf
または
/etc/httpd/conf.d/*.conf
の設定で反映させたい所に反映させる方法。

新しく.htpasswdファイルを作成する場合
#htpasswd -c -b /etc/httpd/conf/.htpasswd user1 password

既にある.htpasswdファイルにユーザを追加する場合
#htpasswd -b /etc/httpd/conf/.htpasswd user2 password


/etc/httpd/conf/httpd.conf
または
/etc/httpd/conf.d/*.conf
に設定を書く。
<Directory "/var/www/html/hogebasic">

AuthUserFile /etc/httpd/conf/.htpasswd
      AuthGroupFile /dev/null
      AuthName "Basic Auth"
      AuthType Basic
      Require valid-user

#    AllowOverride All
      AllowOverride None

      Order allow,deny
#     Allow from 192.168.1.
      Allow from all
</Directory>

設定変更後の再起動
/etc/rc.d/init.d/httpd restart

0 件のコメント:

コメントを投稿