如何在 Azure 虚拟机上访问 AngularJS 应用程序?
How to access AngularJS application on Azure Virtual Machine?
我有 NodeJS 和 AngularJS 应用程序。我正在使用 npm install
下载这两个应用程序的应用程序依赖项。 NodeJS 应用程序在端口 4000
上运行,AngularJS 应用程序在端口 4200
上运行。我可以在浏览器中从 NodeJS 应用程序访问 API,但无法在浏览器中访问应用程序的 UI(AngularJS)。我已经在 Azure 虚拟机上部署了这些应用程序。
我在Azure VM的网络设置中打开了端口4000
和4200
。我正在使用 npm start
命令来启动这两个应用程序。 NodeJS 在本地机器上工作正常,但与 AngularJS 不同。 AngularJS 端没有错误或警告。它表明该应用程序正在侦听 http://localhost:4200/
,但无法访问。
在这种情况下,您需要 运行 ng serve --host 0.0.0.0
以允许您的 AngularJS 应用程序正在侦听 0.0.0.0
以进行外部连接。你可以参考这个
我有 NodeJS 和 AngularJS 应用程序。我正在使用 npm install
下载这两个应用程序的应用程序依赖项。 NodeJS 应用程序在端口 4000
上运行,AngularJS 应用程序在端口 4200
上运行。我可以在浏览器中从 NodeJS 应用程序访问 API,但无法在浏览器中访问应用程序的 UI(AngularJS)。我已经在 Azure 虚拟机上部署了这些应用程序。
我在Azure VM的网络设置中打开了端口4000
和4200
。我正在使用 npm start
命令来启动这两个应用程序。 NodeJS 在本地机器上工作正常,但与 AngularJS 不同。 AngularJS 端没有错误或警告。它表明该应用程序正在侦听 http://localhost:4200/
,但无法访问。
在这种情况下,您需要 运行 ng serve --host 0.0.0.0
以允许您的 AngularJS 应用程序正在侦听 0.0.0.0
以进行外部连接。你可以参考这个