通过http和https都运行Angular 2应用 [英] Run Angular 2 app over http and https both

查看:749
本文介绍了通过http和https都运行Angular 2应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何运行Angular 2应用程序,以便可以通过http和https访问该应用程序吗?我的意思是在两个端口80和443中运行侦听程序?

Does anybody knows how can I run an Angular 2 app where I can access the app over http and https I mean run listening in two ports 80 and 443 ?

这是交易

我有一个可以使用ssl证书运行的应用程序,因此为了通过https访问该应用程序,我需要进行以下配置:

I have an app that I can run with a ssl certificate, so in order access the app over https I have de following configuration:

"serve": {
      "port": 443,
      "host": "0.0.0.0"
    }

但这限制了我只能通过端口443或通过https来访问应用程序,但是我也需要通过http来访问应用程序,我的意思是端口80.

But that limits me to access the app only in port 443 or in other words over https but I need to access the app over http too I mean port 80.

预先感谢

推荐答案

要将一个应用程序配置为http或https,您无需在应用程序本身中执行任何操作,如果您的Web服务器(IIS Apache等)提供了https配置,应用程序已安装在服务器中,则只需配置Web服务器即可管理SSL/TLS连接. ng服务器作为JB Nized点仅用于开发.要使用IIS或APACHE或其他生产Web服务器进行生产. 请参阅以下链接以配置IIS的更多信息:在以下位置配置https IIS

To configure one application to http or https you need to do nothing in the application itself, https configuration is given by the web server (IIS Apache etc) if your application is installed in the server, you only need to configure the web server to manage a SSL /TLS connection. The ng server as point JB Nized is used only for development. to production use IIS or APACHE or other production web server. See the following link to more information to configure IIS: Configure https in IIS

这篇关于通过http和https都运行Angular 2应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆