1.配置httpd.conf文件:
打开 Apache 的 httpd.conf 文件(如:G:\wamp64\bin\apache\apache2.4.9\conf), 添加如下代码:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
如果已存在,将Include前面的#去掉;
2.配置httpd-vhosts.conf 文件:
添加一段代码来指定某一域名的网站,如我配置虚拟域名是:
www.tp5.com,文件目录指向的是项目所在目录;
ServerAdmin webmaster@dummy-host.www.tp5.com
DocumentRoot "G:\wamp64\www\tp5"
ServerName www.tp5.com
ErrorLog "logs/www.tp5.com-error.log"
CustomLog "logs/www.tp5.com-access.log" common
3.配置本地host文件:
4.重启服务
最后一步重启wamp即可