apache配置虚拟主机

步骤如下:

1.在配置文件httpd.conf中启用httpd-vhosts.conf

找到# Virtual hosts将Include conf/extra/httpd-vhosts.conf前的#去掉。

2.假设虚拟主机在f:/myblog(事先要存在该站点,可以是虚拟目录,可以是apache的站点文件)

3.设置httpd-vhosts.conf文件

#配置虚拟主机
<VirtualHost 127.0.0.1:80>
    DocumentRoot "f:/myblog"
    #配置欢迎页
    DirectoryIndex index.php index.html index.htm
    <Directory />
    Options FollowSymLinks
    #访问权限设置
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>
</VirtualHost>

4.修改hosts文件。添加ip和主机映射关系

C:WindowsSystem32driversetchosts.

添加本机ip      域名

原文地址:https://www.cnblogs.com/dreamflycc/p/VirtualHost.html