Basic認証
自分のホーム以下に.htpasswdファイルを配置するとうまく認証できませんでした。
なのであまりよくありませんが面倒なので、/etc/nginx配下で、かつパーミッションは777で。
cd /etc/nginx
htpasswd -c /etc/nginx/.htpasswd hoge
chmod 777 .htpasswd
emacs conf.d/vh_redmine.conf
location / {
....
auth_basic "Secret Area";
auth_basic_user_file "/etc/nginx/.htpasswd";
}
IP制限
上から順に設定が反映されるらしく、allowより前にdenyの設定を入れてしまうとallowが反映されないので注意。
server {
....
allow xxx.xxx.xxx.xxx;
deny all;
}
再起動
/etc/init.d/nginx restart
参考サイト
以下のサイトを参考にさせていただきました。ありがとうございます!