1. add nginx 404 block for spammers and bots based on their user agent. 2. add HTTP basic auth (NGINX and Apache) to protect your site or selfhosted apps from those same spammers, bots and freeloaders (build)

This commit is contained in:
kurets 2024-09-05 21:13:08 +03:00
parent f16bea329c
commit 730355d046
Signed by: kurets
GPG key ID: EEB449C295BF5174
18 changed files with 22 additions and 22 deletions

View file

@ -1,5 +1,5 @@
---
title: "Block and Filter Spam Requests With User-Agents in Nginx"
title: "Block and Filter Spam Requests With User-Agents in NGINX"
date: 2024-09-05T16:58:04+03:00
draft: false
---

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en" class="main-background-image">
<head>
<title>Block and Filter Spam Requests With User-Agents in Nginx | vodoraslo&#39;s blog</title>
<title>Block and Filter Spam Requests With User-Agents in NGINX | vodoraslo&#39;s blog</title>
<link rel="canonical" href="https://vodoraslo.xyz/">
<link rel='alternate' type='application/rss+xml' title="vodoraslo&#39;s blog RSS" href='/index.xml'>
<link rel='stylesheet' type='text/css' href='/style.css?v=1.0.0.12'>
@ -15,11 +15,11 @@ Adapt the following for your use case and simply place it in every nginx.conf th
<div class="main-background-image">
<body>
<main>
<header><h1 style="margin-top: 0%; padding-top: 0.5em;" id="tag_Block and Filter Spam Requests With User-Agents in Nginx">Block and Filter Spam Requests With User-Agents in Nginx</h1></header>
<header><h1 style="margin-top: 0%; padding-top: 0.5em;" id="tag_Block and Filter Spam Requests With User-Agents in NGINX">Block and Filter Spam Requests With User-Agents in NGINX</h1></header>
<hr style="color:var(--strong);background-color: var(--strong); border-color: var(--strong);"><article style="padding: 0% 2.5% 0% 2.5%;">
<div class="breadcrumbs">
<nav><a href="/">vodoraslo</a> /&nbsp;<a href="/articles/">Articles</a> /&nbsp;Block and Filter Spam Requests With User-Agents in Nginx</nav>
<nav><a href="/">vodoraslo</a> /&nbsp;<a href="/articles/">Articles</a> /&nbsp;Block and Filter Spam Requests With User-Agents in NGINX</nav>
</div>

View file

@ -76,7 +76,7 @@ That is no more! I&rsquo;m sick of doing it and I don&rsquo;t know how I just re
<hr style="color:var(--strong); margin: 0; background-color: var(--strong); border-color: var(--strong);">
<div id="nextprev">
<a href="/articles/blog/hugo-drafts-showing-in-production/"><div id="prevart"><i>Previous:</i><br>Hugo: Drafts Showing in Production</div></a>
<a href="/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/"><div id="nextart"><i>Next:</i><br>Block and Filter Spam Requests With User-Agents in Nginx</div></a>
<a href="/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/"><div id="nextart"><i>Next:</i><br>Block and Filter Spam Requests With User-Agents in NGINX</div></a>
</div>
<div ><div style="clear:both" class=taglist>
Tags: [<a id="tag_blog" href="https://vodoraslo.xyz/tags/blog">Blog</a>]

View file

@ -89,7 +89,7 @@ Create a username and password for authentication (or more than 1 user) First:"/
<br>
<hr style="color:var(--strong); margin: 0; background-color: var(--strong); border-color: var(--strong);">
<div id="nextprev">
<a href="/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/"><div id="prevart"><i>Previous:</i><br>Block and Filter Spam Requests With User-Agents in Nginx</div></a>
<a href="/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/"><div id="prevart"><i>Previous:</i><br>Block and Filter Spam Requests With User-Agents in NGINX</div></a>
</div>
<div >
</div>

View file

@ -39,7 +39,7 @@ blog (8) hackbook (59) library (74) ted-kaczynski (15) updates (3) "/>
</div>
<ul>
<li class="index-links"><time datetime="2024-09-05T17:05:07&#43;03:00">2024 Sep 05</time> &ndash; <a href="/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/">Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</a></li>
<li class="index-links"><time datetime="2024-09-05T16:58:04&#43;03:00">2024 Sep 05</time> &ndash; <a href="/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/">Block and Filter Spam Requests With User-Agents in Nginx</a></li>
<li class="index-links"><time datetime="2024-09-05T16:58:04&#43;03:00">2024 Sep 05</time> &ndash; <a href="/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/">Block and Filter Spam Requests With User-Agents in NGINX</a></li>
<li class="index-links"><time datetime="2024-08-31T16:12:49&#43;03:00">2024 Aug 31</time> &ndash; <a href="/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/">Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</a></li>
<li class="index-links"><time datetime="2024-03-17T17:53:39&#43;03:00">2024 Mar 17</time> &ndash; <a href="/articles/blog/hugo-drafts-showing-in-production/">Hugo: Drafts Showing in Production</a></li>
<li class="index-links"><time datetime="2024-02-27T17:04:59&#43;03:00">2024 Feb 27</time> &ndash; <a href="/articles/blog/2024-goals/">2024 Goals and Aspirations</a></li>

View file

@ -75,7 +75,7 @@
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<title>Block and Filter Spam Requests With User-Agents in NGINX</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>

View file

@ -40,10 +40,10 @@
more about Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</a> <em> (1 minute read).</em> </li>
<li><time
datetime="2024-09-05T16:58:04&#43;03:00">2024 Sep 05</time> &ndash;
<a href="/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/" aria-label="Block and Filter Spam Requests With User-Agents in Nginx My server has been getting bussyblasted by spam requests from bots and … ... Click to Read more about Block and Filter Spam Requests With User-Agents in Nginx"><b class="white_span">Block and Filter Spam Requests With User-Agents in Nginx</b></a> - <span
<a href="/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/" aria-label="Block and Filter Spam Requests With User-Agents in NGINX My server has been getting bussyblasted by spam requests from bots and … ... Click to Read more about Block and Filter Spam Requests With User-Agents in NGINX"><b class="white_span">Block and Filter Spam Requests With User-Agents in NGINX</b></a> - <span
class="muted_text">My server has been getting bussyblasted by spam requests from bots and other subhumans and I figured out a way to block them with NGINX.
Adapt the …</span> <a href="/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/" aria-label="Block and Filter Spam Requests With User-Agents in Nginx My server has been getting bussyblasted by spam requests from bots and … ... Click to Read more about Block and Filter Spam Requests With User-Agents in Nginx" class="read_more_recent_posts" style="box-shadow: 0 1px 0;">Read
more about Block and Filter Spam Requests With User-Agents in Nginx</a> <em> (1 minute read).</em> </li>
Adapt the …</span> <a href="/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/" aria-label="Block and Filter Spam Requests With User-Agents in NGINX My server has been getting bussyblasted by spam requests from bots and … ... Click to Read more about Block and Filter Spam Requests With User-Agents in NGINX" class="read_more_recent_posts" style="box-shadow: 0 1px 0;">Read
more about Block and Filter Spam Requests With User-Agents in NGINX</a> <em> (1 minute read).</em> </li>
<li><time
datetime="2024-08-31T16:12:49&#43;03:00">2024 Aug 31</time> &ndash;
<a href="/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/" aria-label="Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag Hugo currently (v133) provides no way for me to choose where to place my … ... Click to Read more about Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag"><b class="white_span">Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</b></a> - <span

View file

@ -75,7 +75,7 @@
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<title>Block and Filter Spam Requests With User-Agents in NGINX</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>

View file

@ -76,7 +76,7 @@
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<title>Block and Filter Spam Requests With User-Agents in NGINX</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>

View file

@ -75,7 +75,7 @@
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<title>Block and Filter Spam Requests With User-Agents in NGINX</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>

View file

@ -76,7 +76,7 @@
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<title>Block and Filter Spam Requests With User-Agents in NGINX</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>

View file

@ -76,7 +76,7 @@
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<title>Block and Filter Spam Requests With User-Agents in NGINX</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>

View file

@ -76,7 +76,7 @@
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<title>Block and Filter Spam Requests With User-Agents in NGINX</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>

View file

@ -76,7 +76,7 @@
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<title>Block and Filter Spam Requests With User-Agents in NGINX</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>

View file

@ -76,7 +76,7 @@
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<title>Block and Filter Spam Requests With User-Agents in NGINX</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>

View file

@ -76,7 +76,7 @@
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<title>Block and Filter Spam Requests With User-Agents in NGINX</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>

View file

@ -76,7 +76,7 @@
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<title>Block and Filter Spam Requests With User-Agents in NGINX</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>

View file

@ -76,7 +76,7 @@
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<title>Block and Filter Spam Requests With User-Agents in NGINX</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>