【Azure 应用服务】App Service For Windows 中如何设置代理实现前端静态文件和后端Java Spring Boot Jar包 - LuBu0505/My-Code GitHub Wiki

问题描述

部署在App Service For Windows 中的网站使用 Java Spring Boot + 静态文件 (浏览器端使用Vue.js 与服务器端Java Spring Boot交互),如何来实现呢?

问题回答

静态文件的部署可以通过App Service的虚拟应用(Virtual Application)来实现【三步】

1:在App Service的门户中,通过Configration 的 Path Mappings来实现,如图: No alt text provided for this image

2:然后将静态文件内容上传至 d:\home\site\staticpage下

3:在目录d:\home\site\staticpage中添加 web.config,指定该虚拟应用为static content,文件内容如下:

<?xml version="1.0" encoding="utf-8"?> 
<configuration>
 <system.webServer>
   <handlers>
     <add name="StaticHandler" verb="*" path="*" type="System.Web.StaticFileHandler" preCondition="integratedMode" />
   </handlers>
 </system.webServer>
</configuration>

配置Java Spring Boot Jar【二步】

1)将App Service runtime stack配置为Java -> Java SE (Embedded Web Server) No alt text provided for this image

2)将主站点的Jar文件重命名为app.jar并上传至d:\home\site\wwwroot下(注:此处不需要web.config,这与通常在Windows部署Java应用有区别) No alt text provided for this image

当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!

分类: 【Azure 应用服务】

标签: App Service, Java Spring Boot + 静态文件

⚠️ **GitHub.com Fallback** ⚠️