简体   繁体   English

如何保护 IIS 上的不同端口?

[英]How to secure different ports on IIS?

I have a VPS on which Windows Server 2019 with IIS 10 is installed.我有一个安装了 IIS 10 的 Windows Server 2019 的 VPS。 I have deployed both front-end (Angular-based) and back-end (.Net API based) projects on different ports of the IIS.我已经在 IIS 的不同端口上部署了前端(基于 Angular)和后端(基于 .Net API)项目。 Angular is hosted on default port (80) and back-end project is hosted on port, say 8031. Angular 托管在默认端口 (80) 上,后端项目托管在端口上,例如 8031。

Now, in order to apply SSL, I have used CertifyTheWeb utility, which is fairly easy.现在,为了应用 SSL,我使用了相当简单的CertifyTheWeb实用程序。 It has automatically applied SSL certificate on the default, front-end project.它已在默认的前端项目上自动应用 SSL 证书。 Now I can access https://example.com .现在我可以访问https://example.com But since the API endpoints of my front-end code point to http://example.com:8031 , I am getting mixed content errors.但是由于我的前端代码的 API 端点指向http://example.com:8031 ,因此我收到了混合内容错误。 I am not sure how to secure the port 8031 using CertifyTheWeb .我不确定如何使用CertifyTheWeb保护端口 8031。 It doesn't accept the domain URL with a port.它不接受带有端口的域 URL。

How can I secure a specific port, or is there anything else that I can try here?我怎样才能保护一个特定的端口,或者我可以在这里尝试什么?

I solved this issue using sub-domain.我使用子域解决了这个问题。 Instead of binding my API project with a port, I bound it with api.example.com, and created a certificate for the same domain in CertifyTheWeb .我没有将我的 API 项目与端口绑定,而是将其与 api.example.com 绑定,并在CertifyTheWeb中为同一域创建了证书。 It's working fine now.现在工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM