1.配置httpd.conf文件:

打开 Apache 的 httpd.conf 文件(如:G:\wamp64\bin\apache\apache2.4.9\conf), 添加如下代码:

# Virtual hosts

Include conf/extra/httpd-vhosts.conf

如果已存在,将Include前面的#去掉;

wamp中Apache配置虚拟主机

2.配置httpd-vhosts.conf 文件:

添加一段代码来指定某一域名的网站,如我配置虚拟域名是:

www.tp5.com,文件目录指向的是项目所在目录;

   

    ServerAdmin [email protected]

    DocumentRoot "G:\wamp64\www\tp5"

    ServerName www.tp5.com

    ErrorLog "logs/www.tp5.com-error.log"

    CustomLog "logs/www.tp5.com-access.log" common

wamp中Apache配置虚拟主机

3.配置本地host文件:

wamp中Apache配置虚拟主机

wamp中Apache配置虚拟主机

4.重启服务

最后一步重启wamp即可

 

 

相关文章: