Apache prohibits direct IP access, only domain access allowed

Source: Internet
Author: User

To enable users to access the site only through the domain name, prohibit the use of IP access, you can add the following code in the httpd.conf configuration file:


<virtualhost 192.168.1.58>

ServerName 192.168.1.58

<location/>

Order Allow,deny

Deny from all

</Location>


</VirtualHost>

<virtualhost 192.168.1.58>

documentroot/var/www/html/

ServerName www.alex.com

</VirtualHost>


The first part: When the user enters IP 192.168.1.58来 Access Direct Deny

The second part: When the user input is the domain name www.alex.com, through.



This article is from the "night Reading Wit Hope female Ghost" blog, please be sure to keep this source http://more3.blog.51cto.com/9929586/1707548

Apache prohibits direct IP access, only domain access allowed

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.