windows IIS7 上可以有一个 IP 地址和两个子域吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8515882/
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
One IP address and two subdomains possible on IIS7?
提问by kurotsuki
Background
背景
I'm using a single server in my home network that runs Windows SBS 2011. It services Active Directory, IIS7 and DNS services.
我在我的家庭网络中使用一台运行 Windows SBS 2011 的服务器。它为 Active Directory、IIS7 和 DNS 服务提供服务。
Currently I can change how my domain (mydomain.com) looks on the Internet using the "Default Web Site" website. However when I create additional websites (blog.mydomain.com) in IIS Manager, they are not showing up on the Internet.
目前,我可以使用“默认网站”网站更改我的域 (mydomain.com) 在 Internet 上的外观。但是,当我在 IIS 管理器中创建其他网站 (blog.mydomain.com) 时,它们没有显示在 Internet 上。
Question 1:Is it possible to set up two subdomains with 1 IP address in Windows IIS7?
问题一:在Windows IIS7中是否可以用1个IP地址设置两个子域?
Can I make it so www.mydomain.com and blog.mydomain.com are both public on the Internet?
我可以让 www.mydomain.com 和 blog.mydomain.com 在 Internet 上都公开吗?
Question 2:How do I go about setting up the subdomain blog.mydomain.com?
问题 2:如何设置子域 blog.mydomain.com?
In IIS Manager, I'm using Sites > Default Web Site for www.mydomain.com files. This is working for me and I can create and set up index.html and build the website.
在 IIS 管理器中,我对 www.mydomain.com 文件使用站点 > 默认网站。这对我有用,我可以创建和设置 index.html 并构建网站。
For the subdomain, after I add a website, what settings do I need to change:
- What settings do I need to have for the website
- What records do I need on the server DNS
- What records do I need on the domain DNS
- What other settings do I need to change?
对于子域,在添加网站后,我需要更改
哪些设置:-网站需要进行哪些设置
- 服务器 DNS 上需要
哪些记录
-域 DNS 上需要哪些记录-我还需要更改哪些其他设置?
回答by nctrnl
Yes, this can be accomplished.
是的,这是可以实现的。
You use the "Bindings..." option In IIS7 for configuring the domain/subdomain for each website.
您可以使用 IIS7 中的“绑定...”选项为每个网站配置域/子域。
This is a way you could set it up:
这是您可以设置的一种方式:
- Make sure you have two websites in IIS7. One is set to the root of your website directory, another one set to the root directory of your blog platform.
- Your website has the binding configured like this: www.mydomain.com using Port 80
- The blog site has the binding configured like this: blog.mydomain.com using Port 80
- 确保您在 IIS7 中有两个网站。一个设置为您网站目录的根目录,另一个设置为您的博客平台根目录。
- 您的网站的绑定配置如下: www.mydomain.com using Port 80
- 博客站点的绑定配置如下: blog.mydomain.com using Port 80
回答by Cosmin Onea
Q1: yes
Q1:是的
Q2: Create two websites, ignore the default web site. One for www and the other for blog. On the new website screen specify the Host Name accordingly, i.e. www.mydomain.com for the first site and blog.mydomain.com for the second. Keep the port 80 for both. Later you can change these settings in the website Bindings screen.
Q2:创建两个网站,忽略默认网站。一个用于 www,另一个用于博客。在新网站屏幕上相应地指定主机名,即 www.mydomain.com 用于第一个站点,而 blog.mydomain.com 用于第二个站点。为两者保留端口 80。稍后您可以在网站绑定屏幕中更改这些设置。
What this basically does it associates names with different websites so when requests come to your server on the same IP IIS knows to which website to dispatch the request.
这基本上做了什么,它将名称与不同的网站相关联,因此当请求到达同一 IP 上的服务器时,IIS 知道将请求发送到哪个网站。
The default website in IIS, because it has no Host Name, will handle all the requests that are neither for www or blog subdomains.
IIS 中的默认网站,因为它没有主机名,将处理所有既不是针对 www 也不是针对博客子域的请求。