How to block ip with NGINX

0. define block ip on nginx.conf

that will blocked ip by clientip on access.log, if want to block real ip behind proxy set like this:

1. define blocked ip in server {}

2. add ip in ban_ip.conf

3. test and reload NGINX