SOFABoot Web adheres to Spring Boot’s "convention over configuration" principle for storing and processing static resources. This article covers the following aspects of static resource management.
This article applies only to SOFABoot web applications.
For additional details on static resources in Spring Boot, see Spring Boot documentation.
Local storage path
Spring Boot automatically handles all static resources, with varying priorities based on their storage locations. In SOFABoot Web applications, the root directory for static resources is: src/main/resources/static/ within the Web module.
Local compiler access
Default Location: src/main/resources/static/index.html in the web module.
Access Procedure:
Start the SOFABoot web application by using a local IDE or by using a
java -jar.Visit the http://localhost:8080/index.html to view it.
Page content: The static page in SOFA Boot based on Spring Boot.
Cloud storage path
Default Processing
After the application is published to Alibaba Cloud ECS, the static resources are decompressed and stored in the following directory: /home/admin/app-run/static. By default, this directory uses Tengine as the page proxy (Web proxy) tool.
Production Environment Processing
In a production workspace, a SOFABoot Web application may provide a large number of static resources to users, causing an access bottleneck. Generally, we recommend that you handle the following issues:
Use page proxies such as NGINX and Apache to access static resources.
Alternatively, deploy static resources on Alibaba Cloud Content Delivery Network servers (mount the
staticdirectory directly on the Alibaba Cloud Content Delivery Network server).