
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:
- Signup on 21YunBox
- Fork strapi-postgres starter
- Create a database
- Create a Cloud Service on 21YunBox, and allow 21YunBox to access your repo
- 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
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:
- Signup on 21YunBox member
- Fork strapi-sqlite starter
- Create a Cloud Service on 21YunBox, and allow 21YunBox to access your repo
- 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:
- How to deploy a Headless CMS Strapi in minutes
- How to use environment variables to store sensitive information
The second part of the screencast shows you:
- How to switch to
development
mode by modifying a environment variable - how to add a new
Shop
in Strapi CMS - How to access
Shop
information via API.
For more tutorials about Strapi, you can check out Strapi’s official introduction video
Related Posts
- Deploy Contentful Site in China With 21YunBox (Step-by-Step Guide)
- US Largest Lighter Delivers Site 8x Faster with 21YunBox
- Turn WordPress into Headless in China
- Publish Websites Using Airtable With 21YunBox
- How to Make Airtable Work in China?
- Does Airtable Work in China?
- Integrate Contentful, Gatsby with 21YunBox
- 5 Steps to Make Static Sites Live in China
- How to Make Contentful Work in China?
- How to Make Sanity CMS Work in China?
- Publish Websites Using Sanity CMS With 21YunBox
- Does Sitecore Work in China?
- Does Sanity CMS Work in China?
- How to host Ghost Blog in China?
- How to Deploy Gatsby Static Sites in China (A Step-by-Step Guide)
- Alternatives to Sanity CMS in China
- Does Salesforce Commerce Cloud Work in China?
- Alternatives to Algolia in China
- Does Contentful Work in China
- How to Deploy Hugo Static Sites in China?
- How to Deploy NextJS Apps in China? (A Step-by-Step Guide)
- How to Deploy Express Apps in China? (A Step-by-Step Guide)
- How to Deploy NuxtJS Apps in China? (A Step-by-Step Guide)
- How to Deploy Jekyll Static Sites in China? (A Step-by-Step Guide)
- How to Deploy Docsify Static Sites in China? (A Step-by-Step Guide)
- How to Deploy VuePress in China? (A Step-by-Step Guide)
- How to Deploy Hexo Static Sites in China? (A Step-by-Step Guide)
- How to Deploy VueJS Apps in China? (A Step-by-Step Guide)
- How to Deploy React Apps in China? (A Step-by-Step Guide)
Recent Posts
-
How To Publish My Game In China
Sep 18, 2023
-
Content Restrictions and Requirements For Publishing Games In China
Sep 5, 2023
-
China Health Gaming Advisory
Sep 2, 2023
-
Method for Determining Illegal and Improper Collection and Use of Personal Information by Apps
Sep 2, 2023
-
Notice on Preventing Minors from Addiction to Online Games
Sep 1, 2023