IIS 相当于 Apache 中的 VirtualHost

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/302968/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 16:58:25  来源:igfitidea点击:

IIS equivalent of VirtualHost in Apache

apacheiisvirtualhost

提问by Jon

Is there an equivalent to Apache's VirtualHost for IIS? We want to be able to run multiple websites from one IP and address them with different DNS names.

是否有相当于 IIS 的 Apache VirtualHost?我们希望能够从一个 IP 运行多个网站,并使用不同的 DNS 名称对它们进行寻址。

i.e. I have

即我有

www.dom1.com
www.dom2.com
www.dom3.com

that all point to 123.123.10.1. Apache would just be running on port 80 and just use virtualhost to decide which site should be served.

这都指向123.123.10.1. Apache 将仅在端口 80 上运行,并仅使用虚拟主机来决定应为哪个站点提供服务。

Is this possible in Windows IIS6?

这在 Windows IIS6 中可能吗?

Thanks

谢谢

采纳答案by ahockley

You want to use Host Headers in IIS- that link will lead to a nice how-to page.

您想在 IIS 中使用主机头- 该链接将指向一个不错的操作方法页面。

回答by Doug

As rob_g suggested, if you already have a website running (eg. default website) you can also select 'Edit bindings' on the website and specify a hostname.

正如 rob_g 所建议的,如果您已经有一个网站在运行(例如默认网站),您还可以在网站上选择“编辑绑定”并指定一个主机名。

回答by Harry Pehkonen

Create a new virtual host:

创建一个新的虚拟主机:

iis manager --> (local computer) --> right-click Web Sites --> New --> Web Site

iis 管理器-->(本地计算机)--> 右键单击​​网站--> 新建--> 网站

Check/change/add hostname information (the other hostname to recognize) on a virtual host:

检查/更改/添加虚拟主机上的主机名信息(要识别的其他主机名):

iis manager --> (local computer) --> Web Sites --> right-click/properties on one of the sites --> Web Site --> Advanced --> "Multiple identities for this Web site"

iis 管理器-->(本地计算机)--> 网站--> 右键单击​​其中一个网站/属性--> 网站--> 高级-->“此网站的多个身份”

回答by antimatter

In IIS 7, you will add in Bindings on the right side Actions column, Edit Site while the desired Site is selected. How to add Virtual Hosts in IIS

在 IIS 7 中,您将在右侧“操作”列中添加绑定,在选择所需站点时编辑站点。 如何在 IIS 中添加虚拟主机