Several commonly used shielding rules for Nginx WEB server in Linux system

888u

Last update at :2024-01-28,Edit by888u

Nginx is a high-performance HTTP and reverse proxy service. Nowadays, many webmasters use Nginx as their WEB server. Although Nginx is powerful, it cannot prevent some malicious access. This article takes the Banwagonhost VPS as an example. Let’s talk about some commonly used blocking rules in Nginx.

Several blocking rules commonly used by Nginx

Nginx prohibits the specified files in the website root directory from being accessed or downloaded

location ~ \.(zip|rar|sql|bak|gz|7z)$ { return 444; }

nginx blocks common spiders

if ($http_user_agent ~* (SemrushBot|python|MJ12bot|AhrefsBot|AhrefsBot|hubspot|opensiteexplorer|leiki|webmeup)) { Return 444; }

nginx prohibits script execution in a certain directory

#templets|data These directories prohibit the execution of PHP location ~* ^/(templets|data)/.*.(php|php5)$ { Return 444; }

nginx screen a certain IP or IP segment

#Block the IP 192.168.5.23 deny 192.168.5.23; #Shield 192.168.5.* this segment denu 192.168.5.0/24;

Recommended solutions for bricklayers

Warm reminder: If you have difficulty choosing, just choose the CN2 GIA-E plan in the middle. The quarterly payment is $49.99, and you can switch between up to 12 computer rooms at will. plan Memory CPU harddisk Traffic/month bandwidth engine room price Buy Banwagonhost Discount Code: BWH3HYATVBJW
CN2 (cheapest) 1GB 1 core 20GB 1TB 1Gbps DC3 CN2 DC8 ZNET $49.99/year Buy
CN2 2GB 1 core 40GB 2TB 1Gbps $52.99/half year $99.99/year Buy
CN2 GIA-E (Most recommended) 1GB 2 cores 20GB 1TB 2.5Gbps DC6 CN2 GIA-E DC9 CN2 GIA Japan SoftBank JPOS_1 Netherlands EUNL_9 $49.99/quarter $169.99/year Buy
CN2 GIA-E 2GB 3 core 40GB 2TB 2.5Gbps $89.99/quarter $299.99/year Buy
HK 2GB 2 cores 40GB 0.5TB 1Gbps Hong Kong, China CN2 GIA $89.99/month $899.99/year Buy
HK 4GB 4 core 80GB 1TB 1Gbps $155.99/month $1559.99/year Buy
TOKYO 2GB 2 cores 40GB 0.5TB 1.2Gbps Tokyo, Japan CN2 GIA $89.99/month $899.99/year Buy
TOKYO 4GB 4 core 80GB 1TB 1.2Gbps $155.99/month $1559.99/year Buy

Select a suggestion:

  • Getting started: Los Angeles CN2 package, currently the cheapest, optional CN2 GT computer room, the entry-level choice.
  • Recommendation: Los Angeles CN2 GIA-E package, super fast, with many optional computer rooms (DC6, DC9, Japan SoftBank, Netherlands Unicom, etc.), the most cost-effective.
  • High-end: Hong Kong CN2 GIA package, the price is higher, but impeccable. The Tokyo CN2 GIA package is also a very good high-end option.

Recommended site searches: Taiwan host, http proxy ip, webmaster ip, domain name registration query, Wanwang domain name space, overseas servers, overseas domain names, US server defense, Taiwan proxy server, mobile server rental,

Several commonly used shielding rules for Nginx WEB server in Linux system

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码