3步配置虚拟主机

来源:互联网 发布:snh48 成员家境 知乎 编辑:程序博客网 时间:2024/05/02 13:19

           具体步骤如下:比如讲apache服务器127.0.0.1 配置成 www.sohu.com

1.首先在http.conf文件中 做如下处理:

      ①关闭默认的#DocumentRoot "C:/Apache2.2/htdocs“

      ②启用httpd-vhosts.conf文件

      # Virtual hosts 启用主机配置文件

      Includeconf/extra/httpd-vhosts.conf

2.在windows/system32/dirvers/etc/hosts文件中加入

            127.0.0.1    www.hanshunping.com

3.在httpd-vhosts.conf文件中加入:

        --简单配置方式

     <VirtualHost 127.0.0.1:80>

     DocumentRoot "d:/myweb"//改成自己的网站根目录C:\amp\apache\htdocs

    DirectoryIndex my.html  index.html  index.htm   index.php

    <Directory />

    Options FollowSymLinks

    AllowOverride None

    Order allow,deny

    Allow from all

    </Directory>

     </VirtualHost>

0 0
原创粉丝点击