【问题标题】:Can we deploy nodejs app and spring-boot app in same Azure-App-Service?我们可以在同一个 Azure-App-Service 中部署 nodejs 应用程序和 spring-boot 应用程序吗?
【发布时间】:2019-01-25 16:14:14
【问题描述】:

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

  • NodeJS
  • 弹簧启动

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

【问题讨论】:

    标签: node.js azure spring-boot azure-web-app-service


    【解决方案1】:

    是的。与其他 SO 线程 Installing wordpress on Azurewebsites running DjangoHow to Deploy Multiple Apps on Azure WebApps 类似。

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

    以下是参考步骤。

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

    示例配置web.config 用于启动SpringBoot jar,来自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,请参考维基页面Using a custom web.config for Node apps

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

    【讨论】:

      猜你喜欢
      • 2017-12-21
      • 2017-12-13
      • 2017-09-23
      • 2020-04-13
      • 2019-05-18
      • 2018-04-15
      • 2017-09-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多