How to Deploy NextJS Apps in China? (A Step-by-Step Guide)
How to Deploy NextJS Apps in China? (A Step-by-Step Guide)

TLDR; This Next.js tutorial provides you with a step-by-step solution to deploy and host Next.js in China with a Vercel-like experience.

What is Next.js?

Next.js is a React framework for production environments. Next.js provides you with all the functions required for the production environment and the best development experience, including static (SSG) and server-side fusion rendering (SSR), support for TypeScript, intelligent packaging, routing prefetching and other functions without any configuration.

21YunBox provides a quick and easy Next.js China deployment method. You can deploy on the 21YunBox using a static site or Node Server.

The difference between the two is that when deploying in the static site mode, the process is that the project will be built (packaged), and then the final generated static resources (HTML, CSS, JS, images, etc.) will be deployed to all parts of the country CDN node. When deploying with a Node Server, the process is to first build the project (package), deploy static resources to CDN nodes across the country, and then start the service into a state of waiting to be accessed, when there is a service request for access When the time, the server will process.

Steps to deploy a NextJS in China:

Option 1: Deploy as SSG mode

  1. Signup on 21YunBox
  2. Fork Next.js SSG starter
  3. Choose the following configuration for deployment
Runtime Static Site
Build command yarn && yarn build && yarn next export
Release dirctory ./out
Step-by-step screencast to show above steps in action
Step by step demonstrates how to deploy Next.js on SSG mode

Option 2: Deploy NextJS in China as SSR mode

Runtime Node
Build command yarn && yarn build
Publish directory yarn next start --port 10000
Step-by-step Video showing how to deploy Next.js to China
Step by step demonstrates how to deploy Next.js in China on SSR mode

Ready to try 21YunBox?

Get Started