Apache prohibits direct access from IP addresses
Add the following code at the end of the httpd. conf file:
The code is as follows: |
Copy code |
NameVirtualHost 1.1.1.1 # Assume that the ip address to be banned is 1.1.1.1. <VirtualHost 1.1.1.1> ServerName 1.1.1.1 <Location/> Order Allow, Deny Deny from all </Location> </VirtualHost> # Deny any access requests directly through the IP address 1.1.1.1. If you use 1.1.1.1 for access, the system will prompt that the access is denied. <VirtualHost 1.1.1.1> DocumentRoot "/var/www/cainiaoer" ServerName www.111cn.net </VirtualHost> # Allow access through the domain name www.111cn.net. The main directory points to/var/www/cainiaoer (assume that the root directory of the website is/var/www/cainiaoer) |
Nginx disables ip access
Prohibit IP addresses from accessing the website directly, modify nginx. conf, and add an empty server:
The code is as follows: |
Copy code |
Server { Server_name _; Return 404; } |
Disable ip access in iis
Step 1: Open the administrative tools-Internet Information Service (IIS) manager, open the website, and select a site
Step 2: Double-click the IP address and domain limit in IIS
Step 3: Add a deny entry in the right column
ZPANEL disables ip access
Method: Add the following content to "httpd. conf":
The code is as follows: |
Copy code |
CentOS:/etc/zpanel/configs/apache/httpd. conf Ubuntu:/etc/zpanel/configs/apache/httpd. conf # Default entry for any undefined domain or direct IP access <VirtualHost *: 80> Redirect 404/ </VirtualHost> Add and execute Service httpd restart |