应用的本地虚拟域名配置

457 阅读1分钟

设置应用的本地虚拟域名配置

效果:可在浏览器中通过 fafa.test 访问应用

  1. 应用可以放在任何地方,不一定要放在apache下
  2. 找到\xampp\apache\conf\extra\httpd-vhosts.conf,输入
NameVirtualHost *:80
<VirtualHost *:80>
	ServerName fafa.test
	DocumentRoot "D:/wamp64/www/blog/public/index.php"
</VirtualHost>
  1. 打开C盘,按路径C:\Windows\System32\drivers\etc找到hosts文件,在最下面添加:
127.0.0.1 fafa.test
  1. 重启apache
  2. 完成