Strapi is the leading open-source headless CMS — a content management backend that exposes REST and GraphQL APIs, consumed by any frontend. Running Strapi v5 on a Hong Kong VPS places the content API close to mainland Chinese frontends via CN2 GIA, enables custom content types for Asia-Pacific requirements, and eliminates Strapi Cloud subscription costs.
Step 1: Install Node.js and Strapi
<code">curl -fsSL https://deb.nodesource.com/setup_20.x | bash - apt install -y nodejs postgresql npm install -g pm2 # Create PostgreSQL database sudo -u postgres psql << 'SQL' CREATE USER strapi_user WITH PASSWORD 'StrapiPass!'; CREATE DATABASE strapi_db OWNER strapi_user; SQL # Create Strapi v5 project npx create-strapi-app@latest /var/www/cms \ --dbclient=postgres \ --dbhost=127.0.0.1 \ --dbport=5432 \ --dbname=strapi_db \ --dbusername=strapi_user \ --dbpassword=StrapiPass! \ --no-run chown -R strapi:strapi /var/www/cms
Step 2: Production Configuration
<code"># config/server.ts
export default ({ env }) => ({
host: env('HOST', '127.0.0.1'),
port: env.int('PORT', 1337),
url: env('PUBLIC_URL', 'https://cms.yourdomain.com'),
app: {
keys: env.array('APP_KEYS'),
},
webhooks: {
populateRelations: env.bool('WEBHOOKS_POPULATE_RELATIONS', false),
},
})
# config/middlewares.ts — add CORS for your frontend
export default [
'strapi::errors',
{
name: 'strapi::security',
config: {
contentSecurityPolicy: {
directives: {
'img-src': ["'self'", 'data:', 'cdn.yourdomain.com'],
},
},
},
},
{
name: 'strapi::cors',
config: {
origin: ['https://yourdomain.com', 'https://admin.yourdomain.com'],
methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'],
headers: ['Content-Type', 'Authorization', 'Origin', 'Accept'],
},
},
'strapi::logger',
'strapi::query',
'strapi::body',
'strapi::session',
'strapi::favicon',
'strapi::public',
]
# .env.production
HOST=127.0.0.1
PORT=1337
PUBLIC_URL=https://cms.yourdomain.com
APP_KEYS=KEY1,KEY2,KEY3,KEY4
API_TOKEN_SALT=RANDOM32CHARS
ADMIN_JWT_SECRET=RANDOM32CHARS
TRANSFER_TOKEN_SALT=RANDOM32CHARS
JWT_SECRET=RANDOM32CHARS
DATABASE_CLIENT=postgres
DATABASE_HOST=127.0.0.1
DATABASE_PORT=5432
DATABASE_NAME=strapi_db
DATABASE_USERNAME=strapi_user
DATABASE_PASSWORD=StrapiPass!
NODE_ENV=production
Step 3: Build and Start with PM2
<code">cd /var/www/cms
npm run build # Build Strapi admin panel
cat > ecosystem.config.cjs << 'EOF'
module.exports = {
apps: [{
name: 'strapi',
script: 'node_modules/.bin/strapi',
args: 'start',
cwd: '/var/www/cms',
instances: 1, # Strapi v5 does not support cluster mode for admin
env_production: {
NODE_ENV: 'production',
},
max_memory_restart: '1G',
error_file: '/var/log/strapi/error.log',
out_file: '/var/log/strapi/out.log',
}]
}
EOF
mkdir -p /var/log/strapi
pm2 start ecosystem.config.cjs --env production
pm2 save
Step 4: Nginx
<code">cat > /etc/nginx/sites-available/strapi << 'EOF'
server {
listen 443 ssl http2;
server_name cms.yourdomain.com;
ssl_certificate /etc/letsencrypt/live/cms.yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/cms.yourdomain.com/privkey.pem;
client_max_body_size 100m; # Allow large media uploads
location / {
proxy_pass http://127.0.0.1:1337;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
EOF
ln -s /etc/nginx/sites-available/strapi /etc/nginx/sites-enabled/
certbot --nginx -d cms.yourdomain.com
nginx -t && systemctl reload nginx
Step 5: Custom Content Types for Asia-Pacific
<code"># Strapi admin → Content-Type Builder → Create new Collection Type
# Example: "Article" with China-specific fields
# api/article/content-types/article/schema.json
{
"kind": "collectionType",
"collectionName": "articles",
"info": {
"singularName": "article",
"pluralName": "articles"
},
"attributes": {
"title": { "type": "string", "required": true },
"title_zh": { "type": "string" }, // Chinese title
"content": { "type": "richtext" },
"content_zh": { "type": "richtext" }, // Chinese content
"wechat_image": { "type": "media" }, // WeChat share image (5:4 ratio)
"category": { "type": "relation", "relation": "manyToOne", "target": "api::category.category" }
}
}
# Query via REST API:
# GET https://cms.yourdomain.com/api/articles?populate=*&locale=zh
# Query via GraphQL:
# POST https://cms.yourdomain.com/graphql
# { articles { data { attributes { title_zh content_zh wechat_image { data { attributes { url } } } } } } }
Step 6: API Tokens for Frontend
<code"># Strapi admin → Settings → API Tokens → Create new token
# Type: Read-only (for public content)
# Expiry: 30 days or unlimited
# Use in frontend (Next.js example):
const response = await fetch('https://cms.yourdomain.com/api/articles', {
headers: {
'Authorization': `Bearer ${process.env.STRAPI_API_TOKEN}`,
'Content-Type': 'application/json',
},
})
const { data } = await response.json()
Conclusion
Strapi v5 on a Hong Kong VPS provides a full-featured headless CMS with REST and GraphQL APIs at CN2 GIA latency for Asia-Pacific frontends. Custom content types accommodate Chinese-language fields and WeChat-specific metadata; API tokens control frontend access granularly; and self-hosting eliminates Strapi Cloud’s $29–99/month subscription cost. For agencies managing content for China-facing websites, the HK VPS location ensures the content API responds quickly to both the editorial team and the end-user frontend.
Deploy your CMS: Browse Server.HK Hong Kong VPS plans — a 2 GB plan handles Strapi v5 with PostgreSQL for most editorial workloads up to several thousand content entries.