美文网首页
WAMPSever多站点配置

WAMPSever多站点配置

作者: WangJing6 | 来源:发表于2016-09-04 13:50 被阅读160次

1、首先找到安装目录下的wamp下bin下apache下apachexxx下conf下extra中的 httpd-vhosts.conf 文件(虚拟目录的配置文件),like this

Paste_Image.png

2、打开 httpd-vhosts.conf 文件

Paste_Image.png

3、复制两份以下代码,如下图所示

Paste_Image.png

4、暂时我们只需要 DocumentRoot 和 ServerName ,为了避免干扰 我们暂时先删除必须要的代码

Paste_Image.png

5、修改 DocumentRoot 和 ServerName ,然后保存

Paste_Image.png

6、由于httpd-vhosts.conf 是作为一个扩展文件去加载的,默认是不会加载的,所以我们需要去告诉我们的Apache去包含这样一个配置文件,打开httpd.conf文件

Paste_Image.png

按住Ctrl+F搜索 httpd-vhost


Paste_Image.png

然后我们只需要将Include前面的#号去掉就行,#号的意思就是将这样代码注释掉,我们只需要去除#号就行了,然后保存


Paste_Image.png

7、因为在Apache中是默认拒绝其他外部主机地址访问服务器下的资源,除了本地的,所以我们还需要修改成允许其他地址访问,所以我们再次打开Apache的配置文件

Paste_Image.png

搜索 onlineoffline


Paste_Image.png

将 Require local 注释掉,在前面加上#号


Paste_Image.png
添加上 Require all granted
Paste_Image.png
然后我们重启所有服务,配置完毕

8、在我们的Demo文件夹中新建我们的test01和test02文件夹

Paste_Image.png

然后在test01和test02文件夹中分别新建index.php文件


Paste_Image.png
Paste_Image.png

分别输出 Hello,test01 和 Hello,test02

Paste_Image.png Paste_Image.png

9、最后打开我们的hosts文件,"C:\Windows\System32\drivers\etc",将我们命名的test01.com和test02.com加入hosts,保存

Paste_Image.png

10、验证是否成功,打开浏览器输入test01.com和test02.com,出线下图则表示配置成功

Paste_Image.png Paste_Image.png

相关文章

网友评论

      本文标题:WAMPSever多站点配置

      本文链接:https://www.haomeiwen.com/subject/jlulettx.html