apache httpd禁止直接用IP访问

搜了半天,最后按下面这种方法搞定的: (不用xml做配置文件的系统都是耍流氓,像httpd.conf这种东西的层次感太不明确了)

引用

NameVirtualHost *:80

<VirtualHost *:80>

        ServerName 111.111.111.111

        <Location />

           Order deny,allow

            Deny from all

        </Location>

</VirtualHost>

<VirtualHost*:80>

        ServerName www.myblog.com

        DocumentRoot /home/me/myblog

        …       

</VirtualHost>

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.