0
0

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 1 year has passed since last update.

EC2 Apacheでベーシック認証を設定する

Posted at

EC2 Apacheでベーシック認証を設定する

$ sudo su -
$ htpasswd -c /etc/httpd/htpasswd ユーザ名
New password: ←パスワード入力
Re-type new password: ←パスワード入力
Adding password for user ユーザ名

$ cat /etc/httpd/htpasswd 
ユーザ名:$apr1$1EUQyMiS$KK1T0nJ15fI/JW6r74WXm/

$ chown apache:apache /etc/httpd/htpasswd
$ chmod 600 /etc/httpd/htpasswd
$ vim /etc/httpd/conf/httpd.conf
以下を追記
<Directory "/var/www/html">
  AuthType Basic
  AuthName "auth"
  AuthUserFile /etc/httpd/htpasswd

  <RequireAny>
  Require ip xxx.xxxx.xxx.xxx ←アクセス許可IP
  Require valid-user
  </RequireAny>
</Directory>

$ systemctl reload httpd.service
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?