LoginSignup
7
10

More than 5 years have passed since last update.

Basic認証とDigest認証

Last updated at Posted at 2014-12-10

Basic認証

htpasswd -b -c -m /etc/httpd/conf/.htpasswd USERNAME PASSWORD
※上記は新規にファイルを作成、既存ファイルがある場合は上書きされます。(新たに追記出来ない)
htpasswd -b /etc/httpd/conf/.htpasswd USERNAME PASSWORD
※上記は既存ファイルにユーザとパスワードが追記されます。

cat /etc/httpd/conf/.htpasswd

vi /.htaccessファイルを置くディレクトリ/.htaccess

.htaccess
AuthUserFile /etc/httpd/conf/.htpasswd
AuthGroupFile /dev/null
AuthName "Secret"
AuthType Basic
require user USERNAME

:wq

service httpd restart

Digest認証

htdigest -c /etc/httpd/.htdigest '領域名' USERNAME

パスワードを入力

cat /etc/httpd/conf/.htdigest

vi vi /.htaccessファイルを置くディレクトリ/.htaccess

.htaccess
AuthType Digest
AuthName "領域名"
AuthUserFile /etc/httpd/.htdigest
Require user USERNAME

:wq

service httpd restart

7
10
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
7
10