问题
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