8
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

nginx IPアドレス制限

Posted at

設定ファイルを開く。

$ sudo vim /etc/nginx/nginx.conf

locationディレクティブにallow,denyを追加する。

allowにアクセスを許可するIPアドレスを。あとはdeny allで全てを拒否する設定にする。記述の上から評価されるため、allowに書いたIPアドレスだけを許可することになる。

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

nginxを再起動して設定を反映させる。

$ systemctl restart nginx
8
12
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
8
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?