首页 > 解决方案 > 我们可以在同一个 Azure-App-Service 中部署 nodejs 应用程序和 spring-boot 应用程序吗?

问题描述

我们正在使用 2 个框架来开发后端:

我们可以在同一个 Azure AppService 实例上部署两个版本吗?有什么建议么?

标签: node.jsazurespring-bootazure-web-app-service

解决方案


是的。它与其他 SO 线程在运行 Django 的 Azurewebsites 上安装 wordpress如何在 Azure WebApps 上部署多个应用程序类似。

您可以在路径中部署一个应用程序,并将wwwroot另一个应用程序部署为另一个子路径中的虚拟应用程序,您在 Azure 门户网站D:\home的选项卡中配置了虚拟目录和路径。Application settings

在此处输入图像描述

这是作为参考的步骤。

  1. 通过 Kudu 控制台other在路径中创建一个目录。site\wwwroot
  2. 将您的两个应用程序的文件分别上传到路径wwwrootohter.
  3. 为不同的应用程序分别在自己的目录中创建web.config文件,其内容如下。

启动 SpringBoot jar 的示例配置web.config,来自Deploying Springboot to Azure App Service

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
    </handlers>
    <httpPlatform processPath="%JAVA_HOME%\bin\java.exe"
        arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar &quot;%HOME%\site\wwwroot\ROOT.jar&quot;">
    </httpPlatform>
  </system.webServer>
</configuration>

Node.js 应用程序的示例配置web.config,请参阅 wiki 页面Using a custom web.config for Node apps

注意配置时使用不同的绝对路径,避免名称冲突。


推荐阅读