Hosting static sites on veFaaS is suitable for scenarios requiring rapid validation and flexible configuration. When combined with APIG, it enables rich traffic control (e.g., rate limiting and authentication) while maintaining a consistent deployment process and operational experience with other functions. This topic describes how to quickly host a static site through veFaaS and obtain an accessible site URL.
veFaaS supports four ways to host static sites. Choose the one that best fits your business requirements.
- Deploy via CLI: It is suitable for scenarios where you already have a frontend project locally and prefer command-line operations. It supports automatic framework detection and build commands, and can be seamlessly integrated into CI/CD pipelines.
- Deploy via veFaaS MCP: It is suitable for quickly publishing HTML reports or frontend build artifacts directly within AI coding tools (such as Trae IDE), without the need to manually write commands.
- Create via application templates (console): It is suitable for scenarios where you need to create and host static applications quickly. The template comes with a built-in static hosting solution, automatically generates an access URL after release, and supports binding to a code repository for continuous development.
- Create via function templates (console): It is suitable for scenarios requiring fine-grained function-level configuration or custom proxy logic. This method is ideal for users who already have experience with function-based projects.
- A Node.js environment has been set up locally. We recommend downloading Node.js version 20.x. For detailed instructions, see the Official documentation. After successful installation, run node --version to check the Node.js version.
The veFaaS CLI tool helps you deploy applications and functions, as well as manage domains and environment variables from your terminal, enabling static site hosting.
- In your terminal, use vefaas login to log in. Follow the prompts to log in using either a Volcano Engine account or AK/SK, then press Enter to confirm.
- AK/SK: The key pair consists of an Access Key ID (AK) and an Access Key Secret (SK). For details, see Access Key management.
- Volcano Engine account: Open the SSO login page in your browser, select the Volcano Engine account you wish to use and authorize it. Upon successful login, you will see a message indicating that the authentication is complete. You may then close the browser tab to finish the login process.
- In your project directory, run the veFaaS command directly, and follow the interactive prompts to create a new Deploy and enter the application name.
- Select a running APIG, and the veFaaS CLI will automatically detect the framework type, build command, artifact path, start command, and listening port used by your current project. It will also automatically select the appropriate runtime. You can adjust these settings as needed. These configurations will be used for the function deployment. For this template project, you can simply use the default configuration.
- The dependency installation and build process will begin. Upon completion, since the veFaaS CLI detects that the current project is a static site, it will automatically generate a DefaultCaddyFile as the configuration file for static resource hosting services. You can adjust them as needed. For this template project, you can simply use the default configuration.
- The veFaaS CLI will upload the build artifacts to veFaaS and initiate the release process. At the same time, an accessible URL will be generated. Once the function deployment is complete, you can use this URL to access the hosted static site.
veFaaS MCP has integrated the capabilities of the CLI, enabling detection of static resources and automatic parameter configuration. For HTML static files or frontend build artifacts, you can quickly deploy them within AI Coding tools using MCP.
- Trae IDE: You can click the button in the overview to quickly jump to the MCP configuration in Trae. For detailed instructions, see Using veFaaS in Trae.
Deploy via application templates
You can quickly create a hosting application for a static site using a template.
- In the top navigation bar, select the target region.
- In the left navigation bar, click App > App plaza.
- On the App plaza page, search for React.js.
- Hover over React.js and click Create app.
- Configure the application.
- Code repository configuration
tip
Code repository configuration enables automatic application build and deployment.
- Read the disclaimer, select the I am aware of the Deployment Risks (Disclaimer) checkbox, and click Create.
- After successful deployment, you can obtain the static site's access URL by clicking Copy address on that application card on the My app page.
Deploy via function templates
tip
After deployment, you can modify the static site configuration file as needed in the function's Code > Resource Manager > DefaultCaddyFile. For details, see Caddy documentation. You can quickly create a hosting function for a static site using the preset example templates for hosting static sites.
- When creating a Web function application for hosting a static site, only the function code needs to be configured as described below. Leave other parameters as the default. For detailed instructions, see Creating web applications.
- Create an APIG trigger to obtain the address of the static site. For detailed instructions, see Creating an APIG trigger.
- In the trigger list, find the trigger you created, and obtain the address of the static site in the Configurations column.