如何设置多个IP地址指向WAMP的服务器上的不同虚拟主机? [英] How do I setup multiple ip addresses to point to different virtual hosts on wamp server?

查看:237
本文介绍了如何设置多个IP地址指向WAMP的服务器上的不同虚拟主机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用WAMP的服务器我的Windows机器上。我想实现以下设置:

I use WAMP server on my Windows machine. I want to achieve the following setup:

1)我想在我的WAMP的万维网目录下创建多个文件夹,每个重presenting网站。
2)多个条目到我的主机文件中的每个指向添加有不同的IP地址,在WAMP的万维网目录中的文件夹中的一个。

1) I want to create multiple folders in my wamp's 'www' directory each representing a website. 2) Add multiple entries to my host file with different ip addresses, each pointing to one of the folders in the wamp's 'www' directory.

因此​​,可以说,我在WAMP的www命名的目录下创建3个文件夹 - 现场1,站点2,site3,并添加以下到我的主机文件:

So lets say, I create 3 folders in my wamp 'www' directory named - "site1", "site2", "site3" and add the following to my host file:

127.0.0.1 site1.local
127.0.0.2 site2.local
127.0.0.3 site3.local

127.0.0.1 site1.local 127.0.0.2 site2.local 127.0.0.3 site3.local

然后我转到的网址site1.local,我能到文件夹SITE1与同为另外两个为好。

And then I goto the url "site1.local", I can get to the folder "site1" and the same for other two as well.

我的知识:
我注意到,即使主机文件是空的,将要任何地址格式 - 127.xx.xx.xx其中xx可以是高达99,最后一个不是0 - 将导致加载默认瓦帕页

My knowledge: I noticed that even if the host file is empty, going to any address in the format - "127.xx.xx.xx" where xx can be upto 99 and the last one not being 0 - will result in loading the default wamp page.

我知道通过Apache的WAMP设置虚拟主机服务器,并针对他们不同的目录中。

I know about setting virtual host servers in wamp through apache and addressing them to different directories.

我的困难:
我试过很多不同的方式,但任何地址只会马上指向我在Apache中设置为主要宿主的默认目录。我认为主机文件是指被用于指向的所有地址到同一点无论我们添加到它什么地址。 (但是,我不知道......)

My difficulty: I tried many different ways but any address would only straight away point to the default directory that I set in apache as the main host. I think the host file is meant to be used to point all the addresses to the same point no matter what address we add to it. (But I'm not sure...)

请帮我实现上述设置。

推荐答案

我可以建议你再次尝试虚拟主机。这里是如何做到这一点的WAMPServer教程。

Can I suggest that you try Virtual Hosts again. Here is a tutorial on how to do it in WAMPServer.

WAMPServer论坛 - HOWTO创建虚拟主机

他们应该做的正是你想要的,但没有需要使用不同的IP地址。当正确设置你需要在浏览器地址栏输入的是你desirecd网站域名即site2.dev和Apache将切换你正确的文档根,因为它是在Apache单个站点的站点将正常工作。

They should do exactly what you want but without the need to use different ip addresses. When setup correctly all you need to enter in the browser address bar is you desirecd site domain name i.e site2.dev and apache will switch you to the correct document root and the site will function as it is were a single site on Apache.

这篇关于如何设置多个IP地址指向WAMP的服务器上的不同虚拟主机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆