Cloud Native 6 min read

Deploy a Static Website to Alibaba Cloud Function Compute with website-fc Plugin

This guide shows how to quickly deploy a pre‑built static website to Alibaba Cloud Function Compute using the @serverless-devs/s CLI and the website-fc plugin, covering project setup, s.yaml configuration, one‑click deployment, and custom domain binding.

Alibaba Cloud Native
Alibaba Cloud Native
Alibaba Cloud Native
Deploy a Static Website to Alibaba Cloud Function Compute with website-fc Plugin

Background

The previous tutorial explained how to deploy a static site to Alibaba Cloud Function Compute (FC) with the @serverless-devs/s CLI. Recent updates to FC and the CLI have introduced the website-fc plugin, allowing a more concise deployment process.

Prerequisites

Alibaba Cloud account with AccessKey and AccessSecret configured.

Node.js environment.

Static site build output (e.g., dist/ containing index.html).

Step 1: Install the CLI and Create s.yaml

Install the Serverless Devs CLI globally: npm install -g @serverless-devs/s In the project root, add an s.yaml file with the following content:

# https://github.com/devsapp/fc/blob/main/docs/zh/yaml/
edition: 1.0.0
name: my-awesome-website-project
services:
  my-service:
    actions:
      pre-deploy:
        - plugin: website-fc   # install website-fc plugin in pre‑deploy slot
    component: devsapp/fc
    props:
      region: cn-shenzhen
      service:
        name: my-awesome-websites
      function:
        name: website-fc-plugin
        runtime: custom
        handler: dummy-handler   # placeholder for custom runtime
        codeUri: ./dist          # deploy the entire dist folder
      triggers:
        - name: http
          type: http
          config:
            authType: anonymous
            methods: [ HEAD, GET ]

The website-fc plugin placed in the pre-deploy slot replaces the earlier manual steps of uploading files and configuring the function.

Step 2: Deploy to Function Compute

After configuring your AccessKey and AccessSecret (see

https://www.serverless-devs.com/serverless-devs/command/config

), run the deployment command: s deploy The static files are uploaded to the FC instance, and the function becomes accessible via an HTTP trigger.

Step 3: Configure a Custom Domain

Create a CNAME record that points to ${UID}.${REGION}.fc.aliyuncs.com. For the example where region is cn-shenzhen, the target becomes xxxxx.cn-shenzhen.fc.aliyuncs.com.

In the FC console, add the custom domain (e.g.,

deploy-static-website-with-website-fc-plugin.example.dengchao.fun

) and bind it to the HTTP trigger.

After DNS propagation, the site can be accessed via the custom domain URL.

Sample Project and References

A complete example repository is available at:

https://github.com/DevDengChao/deploy-static-website-with-website-fc-plugin-example

Additional documentation:

Alibaba Cloud Function Compute product overview: https://help.aliyun.com/document_detail/52895.html

Resource limits: https://help.aliyun.com/document_detail/51907.html

Custom runtime details: https://help.aliyun.com/document_detail/132044.html

Custom domain configuration: https://help.aliyun.com/document_detail/90763.html

Serverless Devs official site: https://www.serverless-devs.com/

website-fc plugin source: https://github.com/devsapp/website-fc

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Cloud NativeServerlessAlibaba CloudFunction ComputeStatic Websitewebsite-fc
Alibaba Cloud Native
Written by

Alibaba Cloud Native

We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.