使用DNS时配置IIS主机名

发布于 2025-02-08 15:58:46 字数 615 浏览 5 评论 0原文

我需要为内部工具使用主机名,因此我提出了DNS Guy的请求,以在DNS服务器配置中添加“ oneplan.dev.ad.trw.com ”。

收到他这样做之后:

但是,当我访问“ OnePlan.dev.ad.trw.com”时,我将获得IIS欢迎页面:

如果我指定端口:OnePlan.dev.ad.trw.com: 6202 。该页面已正确显示。

我需要做什么才能使它在没有URL中的端口的情况下起作用?我无法使用默认端口80,因为我在同一服务器上有多个应用程序。

I need to use a host name for my internal tools so I made a request the DNS guy to add the "oneplan.dev.ad.trw.com" in the DNS server configuration.

After received that he did this:
enter image description here

But when I access the "oneplan.dev.ad.trw.com" I get the IIS welcome page:
enter image description here

And if I specify the port: oneplan.dev.ad.trw.com:6202. The page is displayed correctly.

What I need to to in order to make it work without the port in the URL? I can't use the default port 80 because I have multiple application on the same server.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

初与友歌 2025-02-15 15:58:46

您有两个选项:

选项1-明确主机名

确保没有一个网站在端口80上具有通配符绑定 - 确保它们都指定了唯一的主机名。如果它们看起来如下,则必须添加配置bindings下的显式主机名(例如dev.ad.trw.com或 *.dev.ad.trw.com):

​完成后,您应该能够将新站点的端口从6262更改为80,而IIS将根据主机名将端口80流量路由到适当的站点。

选项2-将IP地址添加到网卡中

以便在同一台计算机上的端口80上的2个站点,而没有选项1中建议的显式主机名,您需要在网络接口中添加一个新的IP地址。我不确定您正在运行哪种版本的Windows以及您的服务器是否已安装Windows GUI。如果确实如此,只需进入卡的网络设置,然后按照下面的说明进行操作即可。这是一个相当直接的。

  1. 首先打开网络连接的属性,突出显示IPv4选项,然后单击属性:

“在此处输入图像说明”

  1. 在“属性”页面上写下IP地址和子网蒙版,然后单击右下角的高级按钮(获取屏幕截图中的截止:

“在此处输入映像说明”

  1. 在“高级属性”页面弹出窗口中,单击“ IP地址”部分中的添加,然后输入带有相同3个八位钟的新的IP地址,对于最终八位目标的20到255 (例如,基于上面的屏幕截图10.27.233.121)。单击确定,直到关闭所有属性对话框。

  1. 接下来进入IIS管理器,单击服务器上的每个站点,然后从右侧的操作面板中选择绑定。确保所有站点都绑定了原始的10.27.233.21 IP地址,例如屏幕截图中的网站。如果您在IP地址看到任何带有通配符“*”的站点,请将它们修改为10.27.233.21。完成此操作后,为您打开网站绑定设置(与您的第一个屏幕截图相同)并配置其绑定新的IP地址10.27.233.121并将端口6202更改为端口80。
  1. ​配置正在工作以下(在服务器上执行此操作):(1)启动具有管理权限的记事本,(2)单击“打开”,(3)将以下路径粘贴到“文件名:” TextBox C:\ Windows \ System32中\ drivers \ etc \ host,(4)单击“确定”以打开文件,(5)在文本文件的底部点击输入,然后粘贴以下 - [ip地址] [tab] [dns name]和(6)保存文件:

10.27.233.121 OnePlan.dev.ad.trw.com

如果网站加载,则全部设置。删除我们在最后一步中添加到主机文件中的行,并告诉您服务器盖伊修改OnePlan.dev.ad.trw.com的DNS记录,以指向10.27.233.121。

You have two options:

Option 1 - Explicit Host Names

Make sure none of the sites have a wildcard binding on port 80 - ensure they all have a unique Host Name specified. If they look like the following, you must added configure an explicit Host Name (e.g. dev.ad.trw.com or *.dev.ad.trw.com) under bindings:

enter image description here

Once this has been completed, you should be able to change the port of your new site from 6262 to 80 and IIS will route port 80 traffic to the appropriate site based upon Host Name.

Option 2 - Add IP Address to Network Card

In order to host 2 sites on port 80 on the same machine without explicit Host Names as suggested in Option 1, you need a new IP address added to the network interface. I'm not sure what version of windows you're running and whether your server has the windows GUI installed. If it does, just go into the network settings for the card and follow the instructions below. It's a fairly straight forward.

  1. First open the properties for the network connection, highlight the IPv4 option and click properties:

enter image description here

  1. On the properties page write down the IP Address and the Subnet Mask and then click the Advanced button on the bottom right (got cutoff in the screenshot:

enter image description here

  1. On the advanced properties page popup, click Add in the IP address section and enter a new IP address with the same 3 octets, and any number between 20 and 255 for the final octet (eg. 10.27.233.121 based on your screenshot above). For the subnet mask copy the subnet form the other IP address(es) configured on the machine (e.g. 255.255.255.0) and click ok to save the settings...and continue clicking OK until all of the properties dialogs are closed.

enter image description here

  1. Next go into IIS Manager, click on each of the sites on the server and select Bindings from the Actions panel on the right side. Make sure all sites are bound the original 10.27.233.21 IP address like the site in your screenshot. If you see any sites with a wildcard "*" for the IP Address, modify them to the 10.27.233.21 as well. Once that's done, open the site bindings settings for you site (same as your first screenshot) and configure its bindings the new IP address 10.27.233.121 and change port 6202 to port 80.

enter image description here

  1. To test that the configuration is working do the following (do this on the server): (1) launch Notepad with administrate privileges, (2) click open, (3) paste the following path into the "File Name:" textbox C:\Windows\System32\drivers\etc\host, (4) click ok to open the file, (5) hit enter at the bottom of the text file and paste the following - [IP Address][Tab][DNS Name], and (6) save the file:

10.27.233.121 oneplan.dev.ad.trw.com

If the site loads, you're all set. Delete the line we added to the Host file in the last step, and tell you server guy to modify the DNS record for oneplan.dev.ad.trw.com to point to 10.27.233.121.

你如我软肋 2025-02-15 15:58:46

打开C:\ Windows \ System32 \ drivers \ etc \ etc \ hosts in Notepad作为管理员,进行输入:

10.27.233.121 OnePlan.dev.ad.ad.trw.com

进入命令窗口(WindowsKey+r tor WindowsKey+r tor Ophan Run Box并输入CMD )和键入ipconfig /flushdns

恭喜,您刚刚覆盖了该域地址的DNS,并且您的计算机专门将始终指向您在主机文件中定义的新IP。请记住,一旦您的域完成了一旦繁殖(您的DNS Guy都应该在处理服务器的DNS中记录记录),请清除它。

open c:\windows\system32\drivers\etc\hosts in notepad as administrator, make an entry:

10.27.233.121 oneplan.dev.ad.trw.com

go into a command window (windowskey+R to open run box and enter cmd) and type ipconfig /flushdns

Congrats, you've just overridden the DNS for that domain address and your computer specifically will always point to the new IP that you defined in the hosts file. Remember to clear it out once your domain is done propagating (your dns guy should have put an A record in the DNS handling the server)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文