0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Nginx : アクセス制限

Posted at

はじめに

Nginxはwebサーバですので、当然アクセス可能なIPアドレスを制限することができます。クラウドを使っている人たちはAGWなどを使っているかもしれませんが、アプリケーション単位でも制限できますので紹介します。

実装方法

実装方法は簡単で、default.confに以下の設定を追加すればよいです。
default.conf

location / {
    allow xxx.xxx.xxx.xxx;
    deny  all;
}

大量の設定が必要な場合は以下のようにすればよいです。
default.conf

location / {
    include allow-list;
}

allow-list

allow xxx.xxx.xxx.xxx;
allow xxx.xxx.xxx.xxx;
allow xxx.xxx.xxx.xxx;
allow xxx.xxx.xxx.xxx;
allow xxx.xxx.xxx.xxx;
allow xxx.xxx.xxx.xxx;

deny all;

参考文献

Nginx : 公式ドキュメント

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?