Otu esi etinye NGINX Ultimate Bad Blocker na Ubuntu 20.04

Mitchell Krog ike NGINX Ultimate Bad Bot & Referrer Blocker, Onye ọkachamara Linux na-elekwasị anya na nchekwa, ma nye ọrụ ya, ị nwere ike ịgwa ya na ọ bụ otu n'ime ndị ezigbo mmadụ. NGINX Ultimate Bad Bot Blocker bụ, ka ọ dị ugbu a, otu n'ime sọftụwia mepere emepe kachasị mma ị nwere ike ibuga na webụsaịtị gị n'efu yana mmelite na-aga n'ihu nke oge ụfọdụ ugboro abụọ n'ụbọchị. Ọrụ sitere na Mitchell na obodo pụtara ìhè.

NGINX Ultimate Bad Bot & Referrer Blocker juputara na njirimara, gbadaa n'okpuru:

  • Ihe mgbochi Bots ọjọọ
  • Ihe mgbochi ndị ọrụ ọjọọ
  • Ihe mgbochi Spam Referrer
  • Ihe mgbochi Adware
  • Ihe mgbochi Ransomware
  • Ihe mgbochi Clickjacking
  • Companieslọ ọrụ SEO na BAD IP Blocker
  • Nginx Rate Limiting Wuru na-emegide DDoS Sistemu
  • Mgbochi ihe nchọpụta isiokwu WordPress

N'ime nkuzi a, ị ga-amụta ka esi eme wụnye Nginx Bad Bot Blocker na Ubuntu 20.04 LTS Focal Fossa.

Prerequisites

Melite Sistemụ Ọrụ

Melite gi Ubuntu Sistemụ arụmọrụ iji hụ na ngwugwu niile dị adị adịla ugbu a:

sudo apt update && sudo apt upgrade -y

Nkuzi a ga-eji ya sudo iwu na na-eche na ị nwere ọnọdụ sudo.

Iji nyochaa ọkwa sudo na akaụntụ gị:

sudo whoami

Ihe atụ na-egosi ọkwa sudo:

[joshua@ubuntu ~]$ sudo whoami
root

Ka ịtọlite ​​akaụntụ sudo dị adị ma ọ bụ ọhụrụ, gaa na nkuzi anyị na Otu esi etinye onye ọrụ na Sudoers na Ubuntu.

Iji mgbọrọgwụ akaụntụ, jiri iwu na-esonụ na paswọọdụ mgbọrọgwụ banye.

su

Wụnye ngwugwu CURL

Iji jiri Nginx Bad Bot Blocker rụọ ọrụ nke ọma mgbe ị wụnyechara, ịkwesịrị ijide n'aka na etinyere curl na sistemụ gị.

Gbaa iwu a ka ịwụnye.

sudo apt install curl -y

Ọ bụrụ na ejighị n'aka, gbanye iwu ahụ n'agbanyeghị, n'ihi na ọ gaghị emerụ sistemu gị.


Advertisement


Wụnye Nginx Bad Bot Blocker

Nzọụkwụ mbụ iji wụnye Bad Bot Blocker bụ nbudata script nrụnye aka na Github gọọmentị. Edemede a ga-edozi usoro ahụ na-akpaghị aka, na n'ọtụtụ oge, ntinye aka dị nta ma emesịa achọrọ.

Iji wget iwu, budata ihe ndị a.

sudo wget https://raw.githubusercontent.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/master/install-ngxblocker -O /usr/local/sbin/install-ngxblocker

Ihe atụ mmepụta:

Otu esi etinye NGINX Ultimate Bad Blocker na Ubuntu 20.04

Na-esote, gaa na ndekọ ma tọọ edemede nrụnye ka a ga-arụ ya.

cd /usr/local/sbin
sudo chmod +x install-ngxblocker 

Ugbu a lelee ka ijide n'aka na ntọala ikike ahụ gara nke ọma tupu ịmee edemede ahụ.

ls -l
Otu esi etinye NGINX Ultimate Bad Blocker na Ubuntu 20.04

Ọ bụrụ na emee nke ọma, ị ga-enwe x na njedebe nke ikike gị, yana install-ngxblocker ịbụ akwụkwọ ndụ akwụkwọ ndụ.

Ugbu a, jiri iwu a mebie edemede a:

sudo ./install-ngxblocker -x

Ebudatala faịlụ achọrọ na akwụkwọ ndekọ aha achọrọ na nwụnye NGINX gị site na ebe nchekwa.

Na-esote, tọọ NGINX Bad Bot Blocker & Referrer melite ma melite scripts ma rụọ ya site na iwu ndị a:

sudo chmod +x /usr/local/sbin/setup-ngxblocker
sudo chmod +x /usr/local/sbin/update-ngxblocker

Lelee ikike chmod, hụ na ọ bụ eziokwu.

Ihe atụ mmepụta:

ls -l
Otu esi etinye NGINX Ultimate Bad Blocker na Ubuntu 20.04

Wụnye Nginx Bad Bot Blocker ugbu a na-eme ihe ederede ntọala.

sudo ./setup-ngxblocker -x

Nsonaazụ na-egosi na agbakwunyere edemede ahụ na faịlụ nhazi vhost NGINX (ihe nkesa ihe nkesa). Ọzọkwa, akụkụ ọzọ dị ịrịba ama nke ntinye edemede a ga-edepụta adreesị IP gị ozugbo na faịlụ whitelist-ips.conf.

Enwere ike ịgbakwunye adreesị IP ọ bụla achọrọ nke chọrọ ndenye ọcha ma emechaa. Ọmụmaatụ ihe ọ nwere ike ịdị ka n'okpuru:

INFO:      /etc/nginx/conf.d/* detected               => /etc/nginx/nginx.conf
inserting: include /etc/nginx/bots.d/blockbots.conf;  => /etc/nginx/sites-available/example.com.vhost
inserting: include /etc/nginx/bots.d/ddos.conf;       => /etc/nginx/sites-available/example.com.vhost

Na-esote, gosi na esonyela na ihe mgbochi bot ọjọọ ahụ nginx.conf faịlụ nhazi site na iji editọ ederede ọ bụla.

Ihe Nlereanya:

sudo nano /etc/nginx/nginx.conf

Na faịlụ nhazi, a ga-agbakwunye ihe ndị a.

# Bad Bot Blocker
include /etc/nginx/bots.d/ddos.conf;
include /etc/nginx/bots.d/blockbots.conf;

Rịba ama, nke a nwere ike ịpụta n'ebe ọ bụla na faịlụ nhazi, ntinye akpaka na nhazi edemede na-eme ike ha niile iji tinye ihe achọrọ gụnyere na ebe kacha mma. N'agbanyeghị nke ahụ, enwere ike ịhazi ya mgbe ụfọdụ, mana ị nwere ike iji aka dozie ya na nginx.conf faịlụ.

Iji mechaa akụkụ nrụnye, anyị ga-eme iwu ndị a iji nwalee wee malitegharịa ihe nkesa NGINX:

sudo nginx -t

Mwepụta ihe atụ ma ọ bụrụ na ọ ga nke ọma:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Gaa n'ihu ka ịmalitegharịa ihe nkesa NGINX:

sudo systemctl restart nginx

Ekele, ị tinyela Nginx Bad Bot Blocker nke ọma na Ubuntu 20.04.

Otu esi edobe ọrụ Cron maka mmelite akpaaka

A na-emelitekarị isi mmalite nke ndị ọrụ-adịghị mma, adreesị IP, ngalaba na ndị ọzọ ugboro abụọ kwa ụbọchị. N'ihi ya, ọ dị oké mkpa ịtọọ ọrụ akpaaka ka ị na-enyocha na imelite iji chebe megide ihe iyi egwu kachasị ọhụrụ. Ụzọ kachasị mma isi mee nke a bụ iji ọrụ cron.

Nke mbụ, mepee crontab na ọdụ gị:

sudo crontab -e

Tinye ihe ndị a, nke atọrọ ka ọ bụrụ oge awa 8 nke akwadoro nke ukwuu nyere edemede mmelite. Ọ dị fechaa nke ukwuu.

00 */8 * * * sudo /usr/local/sbin/update-ngxblocker -e youremail@example.com

Mara, ọ bụrụ na ịmaghị maka ntọala oge cron, gaa CronTab.Guru bụ ezigbo mgbako/nnwale nke ị nwere ike idetuo/mado.

Otu esi etinye NGINX Ultimate Bad Blocker na Ubuntu 20.04

Advertisement


Otu esi ahazi Bad Blocker Bot

Nginx Bad Bot Blocker na-enye gị ike ịhazi onwe ya nke ọma n'ọtụtụ ụzọ dị iche iche, dị ka ịgbakwunye blacklists, whitelists, ndị ọrụ-ọrụ, na ndị ọzọ.

Dịka ọmụmaatụ, gbanwee faịlụ na-esote /etc/nginx/bots.d/blacklist-ips.conf na ịgbakwunye ndetu ojii emere nke ọma.

Otu esi etinye NGINX Ultimate Bad Blocker na Ubuntu 20.04

Uru ọzọ dị ukwuu na-eme ka ndị na-acha ọcha na-eme onwe gị na ndị na-emepụta ihe na-emepụta ihe na-eme ka 100% jide n'aka na egbochighị ha. Ị nwere ike ime nke a site na ịgbakwunye otu adreesị IP ma ọ bụ subnets. 

Ihe Nlereanya:

Otu esi etinye NGINX Ultimate Bad Blocker na Ubuntu 20.04

N'okpuru ebe a bụ ndepụta nhọrọ na ụzọ ha ị nwere ike hazie site na ịgbakwunye data agbakwunyere. Ihe kachasị mkpa bụ na mmelite anaghị emetụta faịlụ nhazi ndị a, yabụ ị gaghị efunahụ data ị gbakwunyere mgbe Nginx Bad Bot Blocker na-emelite onwe ya.

  • /etc/nginx/bots.d/whitelist-domains.conf
  • /etc/nginx/bots.d/blockbots.conf
  • /etc/nginx/bots.d/blacklist-domains.conf
  • /etc/nginx/bots.d/blacklist-user-agents.conf
  • /etc/nginx/bots.d/bad-referrer-words.conf
  • /etc/nginx/bots.d/custom-bad-referrers.conf
  • /etc/nginx/bots.d/ddos.conf

Mmechi na Comments

N'ime nkuzi a, ị mụtala ka esi etinye Nginx Bad Bot Blocker na sava Ubuntu 20.04 LTS. N'ozuzu, nke a dị mma maka sava nwere ohere azụ azụ raara onwe ya nye ma dị oke ọkụ ma nwee ike ịhazi ya, ma ọ bụrụ na saịtị gị nwere nsogbu ọrịa bot, nke a ga-enyere aka kpochapụ ya.

6 echiche na "Otu esi etinye NGINX Ultimate Bad Bot Blocker na Ubuntu 20.04"

  1. wget https://raw.githubusercontent.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/master/install-ngxblocker -O / usr / local / sbin / install-ngxblocker……….. na-abịa na ikike agọnahụ oge ọ bụla ???
    HỤ OKPURU

    user@fxr-i-7:~$ sudo apt update && sudo apt upgrade -y
    [sudo] paswọọdụ maka onye ọrụ:
    Kụrụ: 1 http://security.ubuntu.com/ubuntu gbadoro-nche InRelease
    Kụrụ: 2 http://apt.connectify.me mee ka Mwepụta ngwa ngwa
    Kụrụ: 3 http://ppa.launchpad.net/flatpak/stable/ubuntu Baịbụl hiwere isi n'ebe
    Kụrụ: 4 http://dl.winehq.org/wine-builds/ubuntu Baịbụl hiwere isi n'ebe
    Kụrụ: 5 http://us.archive.ubuntu.com/ubuntu Baịbụl hiwere isi n'ebe
    Kụrụ: 6 http://archive.canonical.com/ubuntu Baịbụl hiwere isi n'ebe
    Kụrụ: 7 http://us.archive.ubuntu.com/ubuntu gbadoro anya-mmelite InRelease
    Kụrụ: 8 http://us.archive.ubuntu.com/ubuntu itinye uche-backports InRelease
    Ndepụta ngwungwu… Emela
    Ewu osisi na-adabere
    Agụ ozi steeti… Emela
    Nchịkọta niile dị ugbu a.
    Ndepụta ngwungwu… Emela
    Ewu osisi na-adabere
    Agụ ozi steeti… Emela
    Na-agbakọ nkwalite… Emela
    Awụnyere ngwungwu ndị a na-akpaghị aka ma ọ chọghịzi:
    gconf-ọrụ gconf-ọrụ-azụ gconf2-nkịtị libappindicator1 libc++1
    libc++1-10 libc++abi1-10 libdbusmenu-gtk4 libgconf-2-4 libllvm11
    libllvm11:i386
    Jiri 'sudo apt autoremove' wepụ ha.
    0 kwalitere, 0 ọhụrụ arụnyere, 0 wepu na 0 adịghị ebuli.
    onye ọrụ @fxr-i-7:~$ wget https://raw.githubusercontent.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/master/install-ngxblocker -O /usr/local/sbin/install-ngxblocker
    /usr/local/sbin/install-ngxblocker: Ajụrụ ikike

    zaghachi
  2. $ sudo ./wget curl
    [sudo] paswọọdụ maka onye ọrụ:
    sudo: ./wget: iwu ahụghị
    onye ọrụ @fxr-i-7:~$ sudo ./wget curl
    sudo: ./wget: iwu ahụghị
    onye ọrụ @fxr-i-7:~$ sudo ./wget curl
    sudo: ./wget: iwu ahụghị
    onye ọrụ @fxr-i-7:~$ local x=based_list=”wget curl”
    bash: local: enwere ike iji naanị n'ọrụ
    onye ọrụ @fxr-i-7:~$ x= depend_list=”wget curl”
    onye ọrụ @fxr-i-7:~$ -z $(find_binary $x)
    find_binary: iwu ahụghị
    -z: iwu ahụghị
    onye ọrụ @fxr-i-7:~$ wget curl
    –2021-10-28 13:24:32– http://curl/
    Na-edozi curl (curl)… dara: Amaghị aha ma ọ bụ ọrụ.
    wget: enweghị ike idozi adreesị onye ọbịa 'curl'
    onye ọrụ @fxr-i-7:~$

    onye ọrụ @fxr-i-7:~$ local x = depend_list = "wget ​​curl" bash: local: enwere ike iji naanị na ọrụ
    onye ọrụ @fxr-i-7:~$ x = dabere_list = "wget ​​curl"
    onye ọrụ @fxr-i-7:~$ -z $(find_binary $x) find_binary: iwu ahụghị -z: iwu ahụghị
    onye ọrụ @fxr-i-7:~$ wget curl --2021-10-28 13:24:32-- http://curl/ Resolving curl (curl)... dara: Amaghị aha ma ọ bụ ọrụ. wget: enweghị ike idozi adreesị onye ọbịa 'curl'
    
    zaghachi
    • Daalụ maka ozi ahụ.

      Emelitela m nkuzi ka m gosipụta itinye ngwungwu curl. Biko mee iwu a.

      sudo dabara wụnye curl -y

      Nke a kwesịrị idozi njehie ị na-enwe. Mee ka m mara ma ọ bụghị.

      Daalụ maka ịbịarute.

      zaghachi

Ahapụ a Comment