nginxでベーシック認証
ちょっとしたセキュリティチェックを設定したい場合
外部のサーバに公開するけど基本参照されたくないから自分のみ用みたいな場合対策
手順
htpasswdを使用してファイルを作成
[root@localhost redmine]# cd /etc/nginx [root@localhost nginx]# htpasswd -c htpasswd ユーザーID New password: Re-type new password: Adding password for user ユーザーID [root@localhost nginx]#
※nginxでもあると思われる
confファイルを編集して認証を追加
location / { auth_basic "Restricted"; auth_basic_user_file htpasswd; proxy_pass http://127.0.0.1:3000; }
リロードして確認して完了
[root@localhost nginx]# service nginx reload [root@localhost nginx]#