Well this is actually what you want, because usually nginx would just send out error 503 and that is simply a server error when instead you are trying to tell the client that the access rate is too high. So we tell nginx to use return code 429 instead of 503:
Put this into nginx.conf in http {}
limit_req_status 429; limit_conn_status 429;