如何在 Azure WebApps 上部署多个应用程序 [英] How to Deploy Multiple Apps on Azure WebApps

查看:19
本文介绍了如何在 Azure WebApps 上部署多个应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个不同的应用程序,我想像这样在同一个 Azure WebApp 上部署它们:

I have two different applications which I want to deploy on the same Azure WebApp like this:

webapp.azurewebsites.net/api/ <-- run the Java REST API here
webapp.azurewebsites.net/site/ <- put the Angular2 app here

问题

这两个应用程序都部署在服务器上,但目前我只能使用 web.config 来运行 REST API,如下所示:

Problem

Both apps are deployed on the server but currently I'm only able to get the REST API running with a web.config like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Force HTTPS" enabled="true">
          <match url="(.*)" ignoreCase="false"/>
          <conditions>
            <add input="{HTTPS}" pattern="off"/>
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent"/>
        </rule>
      </rules>
    </rewrite>
    <handlers>
      <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
    </handlers>
    <httpPlatform processPath="%JAVA_HOME%injava.exe"
                  arguments="-jar D:homesitewwwrootwebapps
est-api.war">
    </httpPlatform>
  </system.webServer>
</configuration>

但我无法访问服务器上的 Angular2 应用程序,而且我找不到有关如何同时配置 Java 应用程序和 Angular2 应用程序的文档.

but I'm not able to reach the Angular2 app on the server and I can't find documentation how I would configure the Java application and the Angular2 app at the same time.

我也尝试使用 Application settings 下 Azure 仪表板中的 Virtual Applications and Directory 设置来实现这一点 - 但它不起作用,我找不到关于我如何实现这一点的体面文档,或者如果设置 虚拟应用程序和目录 甚至可以做到这一点.

I also tried to achieve this with the Virtual applications and directories settings from the Azure dashboard under Application settings - but it didn't work and I can't find a decent documentation of how I would achieve this, or if this is even possible with setting the Virtual applications and directories.

我尝试移动 Angular2 站点,但无法配置服务器,以便在 Java 应用程序运行时可以访问 Angular2 应用程序.

I tried to move the Angular2 site around but was not able to configure the server so that the Angular2 app is accessible while the Java application is running.

有人可以向我指出有关如何实现这一点的良好文档,或详细描述部署过程(关于配置,例如 Azure 仪表板中的 Application settingsweb.config 文件)?

Can someone point me to a good documentation on how to achieve this, or describe the deployment process in detail (with regard to the configs, e.g. the Application settings from the Azure Dashboard and the web.config file)?

推荐答案

根据我的经验,我认为在 Azure WebApps 上部署多个应用的​​最佳方式是设置 Virtual Applications and Directory 的<代码>应用程序设置为您的 Azure Web 应用程序,请参见下图.

Per my experience, I think the best way for deploying multiple Apps on Azure WebApps is to set the Virtual applications and directories of Application Settings for your Azure Webapp, please see the figure below.

作为参考,请参考SO线程的回答添加Azure 上现有网站的虚拟目录.

As reference, please refer to the answer of the SO thread Add virtual directory to existing website on Azure.

Azure 网站支持虚拟目录.有关可以通过 Azure 管理门户执行的操作,请参阅配置 Azure 网站.从 Azure 门户,单击网站并转到配置,然后向下滚动到虚拟应用程序和目录(最后一个配置部分).只需输入您的虚拟目录和相对于站点根目录的物理路径,然后单击保存.

Virtual Directories are supported for Azure Websites. See Configuring Azure Websites for what you can do through the Azure Management Portal. From the Azure Portal, click on the Website and go to Configure, then scroll down to virtual applications and directories (the last config section). Just enter your virtual directory and the physical path relative to the site root and click Save.

这篇关于如何在 Azure WebApps 上部署多个应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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