简体   繁体   English

如何使用IIS 7.5上的不同绑定访问多个网站

[英]How to access multiple website using different bindings on IIS 7.5

How can I access different websites hosted on my local IIS 7.5 (using different bindings) from my ipv4 address? 如何从我的ipv4地址访问我本地IIS 7.5上托管的不同网站(使用不同的绑定)?

My system32\\drivers\\etc\\host file has my binding names mapped to 127.0.0.1 我的system32 \\ drivers \\ etc \\ host文件的绑定名称映射到127.0.0.1

In IIS, I have the normal "Default Web Site". 在IIS中,我有正常的“默认网站”。 Its binding hostname is empty, set to all unassigned ip address and port 80. On my network, I can access this site using the server ipv4 address like so : http://192.168.2.1/mySubSite/index.html where mySubSite is a child folder of the "Default Web Site". 它的绑定主机名为空,设置为所有未分配的IP地址和端口80.在我的网络上,我可以使用服务器ipv4地址访问此站点,如下所示: http://192.168.2.1/mySubSite/index.htmlhttp://192.168.2.1/mySubSite/index.html其中mySubSite是一个“默认网站”的子文件夹。 I can also access it locally using http://localhost/mySubSite/index.html 我也可以使用http://localhost/mySubSite/index.html在本地访问它

If I setup a second website in IIS using the same binding as the "Default Web Site" but using a hostname (say "site2"), I can access it locally using http://site2/mySubSite/index.html . 如果我使用与“默认网站”相同的绑定在IIS中设置第二个网站,但使用主机名(比如“site2”),我可以使用http://site2/mySubSite/index.html在本地访问它。

How can I access this second site on my network the same way I access the "Default Web Site" using the ip address? 我如何使用IP地址访问“默认网站”的方式访问网络上的第二个站点? Is it possible? 可能吗?

the easiest way to do this is to change the port binding on each website. 最简单的方法是更改​​每个网站上的端口绑定。 This takes minimal configuration and you can place a website on any port you want (I recommend ports over 1024...to a maximum of 65000) 这需要最少的配置,你可以在任何你想要的端口上放置一个网站(我建议端口超过1024 ...最多65000)

For example, your default site will automatically be on port 80. Place site 2 on Port 2000. Then you can access your default site like you have above, and you can access site 2 with a similar url like http://192.168.2.1:2000/mySubSite/index.html . 例如,您的默认站点将自动在端口80上。将站点2放在端口2000上。然后您可以像上面一样访问您的默认站点,并且您可以使用类似的URL访问站点2,例如http://192.168.2.1:2000/mySubSite/index.html Notice the port is specified in the url using the :[port] at the end. 请注意,端口是在URL中使用末尾的[port]指定的。

Yes, you can have multiple sites on the same IP address and port. 是的,您可以在同一IP地址和端口上拥有多个站点。 It is called binding by domain name. 它被称为域名绑定。

Open ISS and go to your first default site (one that is functional) and then go to edit bindings. 打开ISS并转到第一个默认站点(功能正常),然后转到编辑绑定。 You will see by default it states "http: Port 80 IP Address *" 您将在默认情况下看到它指出“http:端口80 IP地址*”

Notice the hostname is blank? 请注意主机名是空白的? This is where you can tie a domain name to that exact port. 您可以在此处将域名绑定到该确切端口。 Fill out domain name on both your site bindings. 在您的站点绑定上填写域名。 This means when someone comes in from that exact domain name, it knows where to forward traffic too. 这意味着当某人从该确切的域名进入时,它也知道在哪里转发流量。 If port 80 inbound doesn't match either of those two domain names, it will default to w/e site has no bindings such as the "default site". 如果端口80入站与这两个域名中的任何一个都不匹配,则默认为w / e站点没有绑定,例如“默认站点”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM