Subdomain point to different websites in same IIS

让人想犯罪 __ 提交于 2021-02-10 13:07:54

问题


I have an IIS server With a default Website running, an react app running in the the /LandingPage path and an API used by the React app in the /api, so basically I have:

localhost:80/ -> Default MVC website

localhost:80/LandingPage -> React APP

localhost:80/api -> API to be consumed by the APP.

Currently I have a domain pointing to the server, so I can access it externally, but I want to create a sub-domain to the APP/API so I don't need to see the /LandingPage in my URL's.

Am I able to set my sub-domain to point directly to my localhost:80/LandingPage? Should I do that on IIS or it's done in the DNS config?

Basically accessing "app.domain.com" would point directly to the "localhost:80/LandingPage", is that possible?

Thank you!


回答1:


Yes, it is. You need to create a virtual server on IIS. I'm no expert on IIS, but it involves:

  • Creating different folders for each website.
  • Creating two different Web Site on IIS Manager with the path to your web content folder.
  • Bind your hostname. Bindings option will appear under Actions tab on the right side when you select your website connection under Sites.
    • Once you get to the bindings screen, click Add.
    • Enter your domain name in the Host name field.

More info:

  • Digicert's guide on how to configure host names with screenshots.
  • Microsoft's Documentation on Add/Edit Site Binding.
  • How to properly set bindings in IIS server.
  • Configure a Host Header for a Web Site (IIS 7)


来源:https://stackoverflow.com/questions/51410314/subdomain-point-to-different-websites-in-same-iis

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!