Help us understand the problem. What is going on with this article?

Apache 2.4でBASIC認証

More than 3 years have passed since last update.

Apache 2.4でアクセス制御が変わってBASIC認証設定するのに少し苦労したのでメモ

.htpasswdを作成

htpasswd -c [ファイル名] [登録するユーザー名]

すると対話式でパスワードを聞かれる

.htaccess設定

Apache 2.2までと大幅に変わっているので注意

<Files ~ "^\.(htaccess|htpasswd)$">
Require all denied
</Files>
AuthType basic
AuthName "private area"
AuthUserFile [.htpasswdのフルパス]
Require valid-user

参考

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away