How to limit http connections in Nginx

In this tutorial, we want to discuss about how to limit http connections in Nginx. for some reason, there may be need to limit access to http resources. for example you want to limit bandwidth per IP or number of connection that an IP can establish.