24
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【手順】ダイジェスト認証

Last updated at Posted at 2017-03-03

やること

ApacheのDocumentRootで表示されるページに認証をかける

前提

検証OS: CentOS7
アパッチ: Apache2.4

手順

1. パスワードファイルの生成

# htdigest -c 任意のパスワードファイル名 "領域名" ユーザー名
例
# htdigest -c /etc/httpd/conf/.digestpass "Digest Auth" takahashi
  • -c: パスワードファイルを新規作成(その後ろにファイル名)
  • 領域名: httpd.conf内の「Auth Name」と同様のものを指定する。「""」を忘れないこと!!
  • ユーザー名: ダイジェスト認証時に使用するユーザー名

2. パスワードの設定

New password: 任意のパスワード
Re-type new password: パスワードもう一回

3. 設定ファイルに追記

# vi /etc/httpd/conf/httpd.conf

下記設定を一番下に追記する。
<Directory "/var/www/html">
    AuthType Digest
    AuthName "Digest Auth"
    AuthUserFile "/etc/httpd/conf/.digestpass"
    Require valid-user
</Directory>

4. アパッチの再起動

# systemctl restart httpd

5. ブラウザ上で、サーバーのIPアドレスを入力して認証がかかっていることを確認する。
ユーザー名: 手順1で作成したユーザー名
パスワード: 手順2で作成したパスワード

24
19
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
24
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?