Anti-malware parsing, prohibit IP access to the site's Apache settings

Source: Internet
Author: User

In general, websites can be accessed using domain names and IP. Your site can be directly accessed via IP, which is not a problem, but there are some pitfalls:

    1. Because the search engine will also include your IP address of the page, so the same page search engine will be repeated, resulting in the page weight is not as high as a single inclusion.
    2. The possibility of a malicious domain name pointing. Remember last year's GOOGLE.COM.SB incident? GOOGLE.COM.SB This domain name is malicious point to Baidu, later confirmed GOOGLE.COM.SB this domain name for third party malicious point, not Google. Of course, this is only a joke, but if someone maliciously uses another domain name to resolve to your IP, then your website can be accessed by someone else's domain name. What will happen next? If the domain name is unfriendly domain names, such as once pointed to illegal sites, prone to trigger search engine penalties, and associated IP was implicated. Even if the domain name is not a problem, but traffic will be hijacked to another domain name, which was blocked by the advertising alliance.
    3. ...... Enjoy the Hakata Casino

How to solve this problem? The most straightforward way is to allow users to access the site only through the domain name, not through the IP to directly access. This can be implemented by modifying the Apache configuration file httpd.conf. Here is the implementation of a small station:

Namevirtualhost 121.*.*.*<virtualhost 121.*.*.*>servername 121.*.*.*<location/>Order Allow,DenyDeny From All</location></virtualhost><virtualhost 121.*.*.*>documentroot/var/www/nowamagic/ ServerName Www.nowamagic.net</VirtualHost><VirtualHost 121.*.*.*>documentroot/var/www/nowamagic/ ServerName nowamagic.net</virtualhost>

The first part of the code is to implement any access request that denies the IP directly through 121.*.*.*, and if you use 121.*.*.* access, you will be prompted to deny access.

The second part of the code is to allow access through the http://www.nowamagic.net/domain name, the home directory pointing to/var/www/nowamagic/(here the server OS is CentOS)

The third part of the code is to allow the domain name without www access, you should be able to write along with the above merge.

Recorded here, convenient for later.

Anti-malware parsing, prohibit IP access to the site's Apache settings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.