How to Deploy Strapi Headless CMS in China? (A Step-by-Step Guide)
How to Deploy Strapi Headless CMS in China? (A Step-by-Step Guide)

TLDR; This Strapi tutorial provides you with a step-by-step solution to deploy and host your Strapi Headless CMS in China.


What is Strapi CMS?

Strapi is an open source headless CMS (content management system) built with Node. It comes with a great admin graphical user interface that let your entire content team create and manage content for your websites and apps. Strapi also makes your content available via APIs and can therefore be used in many different ways.


How to Deploy Strapi in China?

21YunBox is Strapi’s recommended deployment and hosting solution for China. You can quickly deploy using Node runtime on 21YuBox.

Depending on how you’re using Strapi, your needs will vary when you deploy your project to production. In this guide we’ll describe two different methods you can use to deploy Strapi in China on 21YunBox, and help you pick the best one for your project.


Option 1 for China: For medium and large projects: Optimize for Scale and Uptime

Strapi can be be set up with the following steps:

  1. Signup on 21YunBox
  2. Fork strapi-postgres starter
  3. Create a database
  4. Create a Cloud Service on 21YunBox, and allow 21YunBox to access your repo
  5. Use the following values during creation
Runtime Node
Build command yarn && yarn build
Start command yarn start

For the choice of configuration, Strapi official documentation suggests Use at least 2GB for servers with memory and 1 core CPU, if you choose a machine with less memory for deployment, the deployment may fail.

Click Advanced Configuration to configure the environment variables

Environment Variable Key Environment Variable Value
NODE_ENV production
DATABASE_URL Click Database URL in the cloud database console to get
JWT_SECRET Randomly generate 32-bit characters*
ADMIN_JWT_SECRET Randomly generate 32-bit characters*

For other related environment variables, please refer to Strapi’s official document

# Randomly generate 32-bit characters
# Enter on the command line, and paste the generated characters into the environment variable

echo $(base64 /dev/urandom | head -c32)

6. Click “Create Now”

Step-by-step screencast to show above steps in action

How to deploy the Strapi + Postgres database to the server in China | 21YunBox


Option 2 for China: For small and medium-sized projects: Optimize for Cost and Simplicity

Strapi can be be set up with the following steps:

  1. Signup on 21YunBox member
  2. Fork strapi-sqlite starter
  3. Create a Cloud Service on 21YunBox, and allow 21YunBox to access your repo
  4. Use the following values during creation
Runtime Node
Build command yarn && yarn build
Start command rsync -a public/ /data/public/ && yarn start

In terms of choice of configuration, Strapi official documentation suggests Use at least 2GB For servers with memory and 1 core CPU, if you choose a machine with less memory for deployment, the deployment may fail.

Click Advanced Configuration to configure environment variables

Environment Variable Key Environment Variable Value.
NODE_ENV production
DATABASE_FILENAME /data/strapi.db
JWT_SECRET Randomly generate 32-bit characters*
ADMIN_JWT_SECRET Randomly generate 32-bit characters*

For other related environment variables, please refer to strapi official document

# Randomly generate 32-bit characters
# Enter on the command line, and paste the generated characters into the environment variable

echo $(base64 /dev/urandom | head -c32)

5. Click “Create”



A Step-by-step screencast to master the basic of Strapi


The first part of the screencast shows you:

  1. How to deploy a Headless CMS Strapi in minutes
  2. How to use environment variables to store sensitive information
How to deploy Strapi in China - Part 1


The second part of the screencast shows you:

  1. How to switch to development mode by modifying a environment variable
  2. how to add a new Shop in Strapi CMS
  3. How to access Shop information via API.
How to deploy Strapi in China - Part 2

For more tutorials about Strapi, you can check out Strapi’s official introduction video

Ready to make your app work in China?

Get Started Questions? Talk to an expert.

Ready to try 21YunBox?

Get Started