我有一个 IIS 服务器,运行一个默认网站,一个在 /LandingPage 路径中运行的 React 应用程序以及一个由 /api 中的 React 应用程序使用的 API,所以基本上我有:
localhost:80/ -> 默认 MVC 网站
本地主机:80/LandingPage -> React APP
localhost:80/api -> APP要使用的API。
目前,我有一个指向服务器的域,因此我可以从外部访问它,但我想为 APP/API 创建一个子域,这样我就不需要在 URL 中看到 /LandingPage。
我可以将子域设置为直接指向我的 localhost:80/LandingPage 吗?我应该在 IIS 上执行此操作还是在 DNS 配置中执行此操作?
基本上访问“app.domain.com”会直接指向“localhost:80/LandingPage”,这可能吗?
谢谢你!
是的。您需要在 IIS 上创建虚拟服务器。我不是 IIS 专家,但它涉及:
- 为每个网站创建不同的文件夹。
-
在 IIS 管理器上创建两个不同的网站 https://learn.microsoft.com/en-us/iis/get-started/getting-started-with-iis/create-a-web-site以及您的 Web 内容文件夹的路径。
-
Bind your hostname. Bindings option will appear under Actions tab on the right side when you select your website connection under Sites.
- 进入绑定屏幕后,单击Add.
- 在中输入您的域名主机名 field.
更多信息:
-
有关如何配置主机名的 Digicert 指南截图 https://www.digicert.com/ssl-support/ssl-host-headers-iis-8.htm.
-
Microsoft 有关添加/编辑站点绑定的文档 https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc771629(v=ws.11).
-
如何正确设置 IIS 服务器中的绑定 https://serverfault.com/questions/445548/how-to-properly-set-bindings-in-iis-server.
- 为网站配置主机标头 (IIS 7) https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc753195(v=ws.10)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)