2020年8月24日月曜日

laravel projectにてhtpasswd でbase認証をかける

1)base認証用password fileを作成

mkdir /etc/htpasswd (必要に応じて)

htpasswd -c /etc/htpasswd/.htpasswd username(コマンドを実行すると、PW入力を要求される)


2)/var/www/html/site/public/.htaccess を変更

一番上に、以下を追加


AuthType Basic

AuthName "Authentication Required"

AuthUserFile "/etc/htpasswd/.htpasswd"

Require valid-user

0 件のコメント:

コメントを投稿