From f16bea329cf4ea939fb7bbd935189ef2a688fd0f Mon Sep 17 00:00:00 2001 From: kurets Date: Thu, 5 Sep 2024 17:24:19 +0300 Subject: [PATCH] 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) --- .../index.html | 2 +- .../index.html | 2 +- public/sitemap.xml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/index.html b/public/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/index.html index 384bc58f..c099f1a5 100644 --- a/public/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/index.html +++ b/public/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/index.html @@ -23,7 +23,7 @@ Adapt the following for your use case and simply place it in every nginx.conf th -

作成日: , 最終更新日:

+

作成日: , 最終更新日:

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 following for your use case and simply place it in every nginx.conf that is ln -s linked to your /etc/nginx/sites-enabled (it should be under the listen 443 server block if you use certbot. Don’t add it under location it should be on the same level as listen [::]:443 ssl;)

diff --git a/public/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/index.html b/public/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/index.html index eb457fbe..9534ec70 100644 --- a/public/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/index.html +++ b/public/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/index.html @@ -24,7 +24,7 @@ Create a username and password for authentication (or more than 1 user) First:"/
-

作成日: , 最終更新日:

+

作成日: , 最終更新日:

Here’s how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system’s (or your vps’) resources for yourself.

The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith’s tutorial and have NGINX running with certbot for certificates.

Create a username and password for authentication (or more than 1 user)

diff --git a/public/sitemap.xml b/public/sitemap.xml index b508c72d..2ee17fef 100644 --- a/public/sitemap.xml +++ b/public/sitemap.xml @@ -3,10 +3,10 @@ xmlns:xhtml="http://www.w3.org/1999/xhtml"> https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/ - 2024-09-05T17:05:07+03:00 + 2024-09-05T17:22:43+03:00 https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/ - 2024-09-05T16:58:04+03:00 + 2024-09-05T17:22:43+03:00 https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/ 2024-08-31T17:06:20+03:00