Skip to content

Instantly share code, notes, and snippets.

@itkq
Last active March 27, 2017 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itkq/c8e28dd5ac52baa713c688ce5bb0e69e to your computer and use it in GitHub Desktop.
Save itkq/c8e28dd5ac52baa713c688ce5bb0e69e to your computer and use it in GitHub Desktop.
#!/bin/bash
ls /var/log/nginx/access.log-*.gz | tail -n 1 \
| xargs zgrep 404 | egrep 'php|admin|db|sql|struts' | awk '{print $1}' | uniq \
| awk '{$0="deny " $0 ";"; print}' >> /etc/nginx/dropip.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment