Four methods to disable ip address access in apache

Source: Internet
Author: User
The code is as follows: Copy code

Namevirtualhost *: 80

<Virtualhost 59.60.30.212: 80 >=> this IP address must be specified.
Serveradmin conkeyn@163.com
Servername 59.60.30.212
<Location/>
Order deny, allow
Deny from all
</Location>
</Virtualhost>


Method 2 add the following code at the end of the httpd. conf file

Namevirtualhost 221 .*.*.*
<Virtualhost 221. *>
Documentroot "c:/test"
Server name 221 .*.*.*
</Virtualhost>
<Virtualhost 221. *>
Documentroot "c:/web"
Servername
</Virtualhost>

Note: the blue part passes through 221. *. *. * direct access requests from this ip address point to the c:/test Directory. This can be an empty directory or a home page file, such as index, can be created. hmtl. The content of the first file can be a declaration.

 

Method 3: Create a VM,

The code is as follows: Copy code
Servername ipaddress (for example, 192.168.0.1)
Documentroot/usr/local/apache/nosite/


In this way, you can.
Create an index.htm under/usr/local/apache/nosite/and prompt the user that ip access is not allowed. Or other error messages.

Method 4:

The code is as follows: Copy code
Servername ipaddress (for example, 192.168.0.1)
Documentroot/usr/local/apache/nosite/
Order deny, allow
Deny from all
Related Article

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.