Forked from AysadKozanoglu/nginx-rate_limit_flood_protect.conf
Created
June 30, 2017 18:54
-
-
Save valentinvichnal/46cf6e74220bedde00e3f37f654e83fe to your computer and use it in GitHub Desktop.
request flood protection rate limiting nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # To enable rate limiting simply add the following line to the top-level of your config file: | |
| # 1 request / second | |
| limit_req_zone $binary_remote_addr zone=login:10m rate=1r/s; | |
| # Then apply it to a location by adding a rate limiting burst to your server block: | |
| location /account/login/ { | |
| # apply rate limiting | |
| limit_req zone=login burst=5; | |
| # boilerplate copied from location / | |
| proxy_pass http://myapp; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_set_header Host $http_host; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment