1.打开Apache的配置文件httpd.conf 修改Virtual hosts 为开启状态
# Virtual hosts
# Include conf/extra/httpd-vhosts.conf
修改为:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
2. 打开D:\wamp\Apache24\conf\extra 下面的 httpd-vhosts.conf,增加下面代码
<VirtualHost *:8989>
# ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "D:/www/Magento-CE-2.2.7/"
ServerName local_m2.com
# ErrorLog "logs/dummy-host2.example.com-error.log"
# CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
3 . 修改C:\Windows\System32\drivers\etc目录下的hosts文件

解决办法:把文件复制出来,编辑了,再复制进去。