In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
There are many ways to prohibit IP from accessing the website, and there are different methods for different server environments. I would like to summarize our commonly used configuration methods to prohibit IP from accessing the website. I hope it will be helpful to you.
PHP forbids access to an IP or IP segment
Don't talk too much nonsense, guest officer, please take a look:
Apache forbids IP access
Method 1: at the end of the httpd.conf file, add the following code
NameVirtualHost 221.*ServerName 221.*Order Allow,Deny Deny from all DocumentRoot "c:/web" ServerName www.iis7.com
Note: the blue part is to deny any access request directly through the 221.* IP. If you use 221.* access, you will be prompted to deny access. The red part allows access through the domain name www.iis7.com, and the home directory points to c:/web (assuming that the root directory of your site is c:/web)
Linux blocks IP access
# the command to shield a single IP is iptables-I INPUT-s 123.45.6.7-j DROP# seal the entire segment, that is, from 123.0.0.1 to 123.255.255.254 iptables-I INPUT-s 123.0.0.0 DROP# seal IP section, that is, from 123.45.0.1 to 123.45.255.254 command iptables-I INPUT-s 124.45.0.0 IP segment from 123.45 The command from .6.1 to 123.45.6.254 is iptables-I INPUT-s 123.45.6.0 account 24-j DROPservice iptables save
Save in / etc/sysconfig/iptables if there is no iptables file, it will be created automatically.
Nginx forbids IP access
First, create the following configuration file and put it in the conf directory of nginx and name it blocksip.conf:
Deny 4.4.4.4 / / this is the IP to be banned by nginx
Keep it.
Add: include blocksip.conf; to nginx's configuration file nginx.conf, and then restart nginx to take effect. When the blocked ip opens the site, it prompts:
403 Forbidden
There are many other formats for blocksip.conf: you can configure only allowed IP access or IP segment access:
Deny IP
Allow IP
# block all ips
Deny all
# allow all ips
Allow all
The network segment is written as follows: 192.168.1.0 and 24.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.