Apache 配置虚拟目录和虚拟主机

Apache配置虚拟目录

在httpd.conf文件中添加 大约在245行

# Create Virtual catalogue
<IfModule dir_module>
    DirectoryIndex index.html index.htm index.php
    Alias /MyWeb "c:/MyWeb" // 在C盘的根目录下有一个Myweb文件夹,可以把这个文件夹看做虚拟目录
    <Directory c:/MyWeb>
        Order allow,deny
        Allow from all
    </Directory>
</IfModule>

 

Apache配置虚拟主机

在httpd文件中打开Virtual Host 大约在480行

# Virtual hosts 配置虚拟主机
Include conf/extra/httpd-vhosts.conf

 

接下来修改conf/extra/httpd-vhosts.conf文件

在最后一行添加

#配置自己的虚拟主机
<VirtualHost 127.0.0.1:80>
    DocumentRoot "c:/MyWeb"
    DirectoryIndex index.html index.htm index.php
    <Directory />
    Options FollowSymLinks
    #Not allow others to correct our page
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>
</VirtualHost>

 

 

最后一项

修改hosts 文件 windows->system32->Drivers->etc->hosts

添加 127.0.0.1    www.baidu.com  

完了之后,从此以后就上不去百度了

 

posted @ 2014-12-13 22:38  闪光阳  阅读(2042)  评论(1编辑  收藏  举报