I am learning nginx, and need a sandbox to experiment with the config file syntax and run some tests.
This is it. To use it, simply run vagrant up
.
This snippet achieves an equivalent effect as the following (invalid) conditional:
if ($suspicious_ip = 1 && ($suspicious_agent = 1 || $request_method = HEAD) {
return 403;
}
Resources:
- Nginx Blocking by User Agent | Web and IT Support Blog
- Blocking by user agent if ip doesn't match - Ruby Forum
- Nginx Hardening - Some Good Security Practices - fralef.me
- Nginx Block And Deny IP Address OR Network Subnets
- Use Nginx to server different pages depending on IP address/subnet - Server Fault
- Nginx how to multiple if statements - Ross Lawley
- Module ngx_http_geo_module