Skip to content

Instantly share code, notes, and snippets.

@AlekseyArh
Last active March 19, 2024 15:43
Show Gist options
  • Save AlekseyArh/c815f70cfe0036928ebe5074b3bf9f4a to your computer and use it in GitHub Desktop.
Save AlekseyArh/c815f70cfe0036928ebe5074b3bf9f4a to your computer and use it in GitHub Desktop.
Блокировка запросов в nginx
# Блокировка запросов в nginx по user agent (включая пустой user_agent - ^$)
if ( $http_user_agent ~* (^$|wget|curl) ) {
return 418 " ";
}
# Блокировка по части ссылки
location ~ (wp-|\.php$|\.jsp$|\.asp$|\.perl$|\.env$|\.git) {
return 418 " ";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment