From dc1261d703ae1e1a14841b030888e3f87ff7c38f Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Wed, 1 May 2024 21:45:52 -0500 Subject: prettier formatting and rewrap lines --- content/blog/2022-11-29-nginx-referrer-ban-list.md | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'content/blog/2022-11-29-nginx-referrer-ban-list.md') diff --git a/content/blog/2022-11-29-nginx-referrer-ban-list.md b/content/blog/2022-11-29-nginx-referrer-ban-list.md index 62d00c4..2a7f68f 100644 --- a/content/blog/2022-11-29-nginx-referrer-ban-list.md +++ b/content/blog/2022-11-29-nginx-referrer-ban-list.md @@ -20,7 +20,7 @@ doas nano /etc/nginx/banlist.conf Next, paste the following contents in and fill out the regexes with whichever domains you're blocking. -``` conf +```conf # /etc/nginx/banlist.conf map $http_referer $bad_referer { @@ -45,7 +45,7 @@ doas nano /etc/nginx/nginx.conf Within this file, find the `http` block and add your ban list file location to the end of the block. -``` conf +```conf # /etc/nginx/nginx.conf http { @@ -76,7 +76,7 @@ Code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) you want. Code 403 (Forbidden) is logical in this case since you are preventing a client connection due to a banned domain. -``` conf +```conf server { ... @@ -108,7 +108,7 @@ curl https://cleberg.net The HTML contents of the page come back successfully: -``` html +```html ... ``` @@ -122,12 +122,15 @@ This time, I'm met with a 403 Forbidden response page. That means we are successful and any clients being referred from a banned domain will be met with this same response code. -``` html +```html -403 Forbidden - -

403 Forbidden

-
nginx
- + + 403 Forbidden + + +

403 Forbidden

+
+
nginx
+ ``` -- cgit v1.2.3-70-g09d2