How to Deploy Next.js to a Server?

21YunBox
3 min readDec 30, 2020
Next.js Official Website

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 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.

Methods to Deploy Next.js

Use static site operating environment to deploy in SSG mode

  1. Register as 21YunBox member
  2. Fork Next.js exampleSSG
  3. Choose the following configuration for deployment

Steps to Deploy Static Site

You can also refer to the video below for a step by step example:

Step by step example how to deploy Next.js to the server (SSG/static page) operation video

Use Node Server Operating Environment to Deploy in SSR Mode

If you are not sure what to do, you can refer to:

Step by step example how to deploy Next.js to the server (SSR/backend)

Why Choose 21YunBox?

21YunBox is a Cloud Service platform based out of Beijing. Our services enable your team to be more effective in leveraging the growing opportunity within China by hosting your sites at blazing speeds with an operational and maintenance free solution.

We offer an easy and budget friendly, end-to-end web platform deployment service for all applications from small teams to large enterprises using a low-code solution.

We also offer full support in obtaining your ICP license. This allows you to do legally do business inside of Mainland China.

To learn about the differences between 21YunBox and these foreign (outside of China) cloud service platforms? You can refer to:

Originally published at https://launch-in-china.21yunbox.com on December 30, 2020.

--

--