How to disable ip access by virtual host
How does a virtual host disable ip access? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.
After building the website, the virtual host will inevitably encounter some malicious attacks, malicious registration, malicious comments and other behaviors. At this time, we can block each other's IP to reject these malicious acts.
Generally speaking, cloud service providers rarely provide features that prohibit IP access, but we can configure them ourselves. The method is to add a rule that prohibits IP access in the virtual host configuration file. The Linux system is placed in the .htaccess file, and the Windows system is placed in the web.config file.
Suppose:
Mask IP 8.8.4.4 write (8.8.4.4)
Block IP segment 8.8.8. Then write (8.8.8.)
Block multiple segments for intermediate use | separated, such as (8.8.4.4 | 8.8.8.)
How does the Linux virtual host prohibit ip access:
RewriteEngine On#Block ipRewriteCond% {http:X-Forwarded-For} &% {REMOTE_ADDR} &% {http:X-Real-IP} (8.8.4.4 | 8.8.8.) [NC] RewriteRule (. *)-[F]
How does the Windows virtual host prohibit ip access:
Through these rules, we can block these problematic ip. If in practice, it cannot be realized, or there is a problem. It is recommended to consult the cloud service provider for technical customer service.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.