apache window环境下本地配置虚拟主机

1.在httpd.conf中去掉如下注释:

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

2.在 httpd-vhosts.conf添加内容

例如:

NameVirtualHost *:80 

<VirtualHost *:80>
    DocumentRoot “你的项目绝对地址”
    ServerName xxx.com
    ErrorLog logs/abc.sh.cn-error_log 
</VirtualHost> 

3.打开C:/Windows/System32/drivers/etc/hosts 文件

添加记录

127.0.0.1 xxx.com

4.然后重启apache 服务。

原文地址:https://www.cnblogs.com/dai330713/p/3296102.html