diff options
author | Christian Cleberg <hello@cleberg.net> | 2024-05-01 21:45:52 -0500 |
---|---|---|
committer | Christian Cleberg <hello@cleberg.net> | 2024-05-01 21:45:52 -0500 |
commit | dc1261d703ae1e1a14841b030888e3f87ff7c38f (patch) | |
tree | 71139c9021b09704b2d45be3b64d54e2acbae55f /content/blog/2022-11-29-nginx-referrer-ban-list.md | |
parent | ba6b552c8256cc2e071c910ef7821c82443f1f82 (diff) | |
download | cleberg.net-dc1261d703ae1e1a14841b030888e3f87ff7c38f.tar.gz cleberg.net-dc1261d703ae1e1a14841b030888e3f87ff7c38f.tar.bz2 cleberg.net-dc1261d703ae1e1a14841b030888e3f87ff7c38f.zip |
prettier formatting and rewrap lines
Diffstat (limited to 'content/blog/2022-11-29-nginx-referrer-ban-list.md')
-rw-r--r-- | content/blog/2022-11-29-nginx-referrer-ban-list.md | 23 |
1 files changed, 13 insertions, 10 deletions
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 <!doctype 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 <html> -<head><title>403 Forbidden</title></head> -<body> -<center><h1>403 Forbidden</h1></center> -<hr><center>nginx</center> -</body> + <head> + <title>403 Forbidden</title> + </head> + <body> + <center><h1>403 Forbidden</h1></center> + <hr /> + <center>nginx</center> + </body> </html> ``` |