ubuntu16.04にapacheをinstallしてbasic認証をかける
2. basic auth
touch /etc/apache2/sites-available/auth-basic.conf vi /etc/apache2/sites-available/auth-basic.conf ### 以下を入力して保存 <Directory /var/www/html> AuthType Basic AuthName "Basic Authentication" AuthUserFile /etc/apache2/.htpasswd require valid-user </Directory> htpasswd -c /etc/apache2/.htpasswd hoge New password: ****** Re-type new password: ****** Adding password for user hoge cd /var/www/html a2ensite auth-basic Enabling site auth-basic. To activate the new configuration, you need to run: service apache2 reload sudo /etc/init.d/apache2 restart
もう一度アクセスしてbasic認証がかかっていることを確認