本地配置虚拟站点

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/happy_teemo/article/details/81903581

三个文件:

1.C:\Windows\System32\drivers\etc\hosts

127.0.0.1  [www.test.com](http://www.test.com/)

2.Apache目录下,httpd.conf  

LoadModule vhost_alias_module modules/mod_vhost_alias.so  这一句前面的#去掉,表示支持虚拟目录

3.vhosts.conf


<VirtualHost *:80>
    ServerAdmin [www.test.com](http://www.test.com/)
    DocumentRoot "D:\phpStudy\PHPTutorial\WWW\TP5\Public"
    ServerName [www.test.com](http://www.test.com/)
</VirtualHost>
ServerAdmin [[email protected]](mailto:[email protected])
DocumentRoot "E:/bd/ems" //这个为您的项目目录 意思就是把虚拟域名绑定到这个目录下
ServerName [singwa.com](http://singwa.com/) //这个为您在host中配置 也就是虚拟域名
ErrorLog "logs/[dummy-host2.example.com-error.log](http://dummy-host2.example.com-error.log/)" // 错误日志文件
CustomLog "logs/[dummy-host2.example.com-access.log](http://dummy-host2.example.com-access.log/)" common

相当于先访问 hosts文件,找不到对应IP才去外网找

猜你喜欢

转载自blog.csdn.net/happy_teemo/article/details/81903581