Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to deploy a Next.js project to a server

Shulou Source: shulou.com Published: 2022-05-31 20:02:14 09月19日 Update

How to deploy the Next.js project to the server, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

What is Next.js?

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

21 Cloud Box provides a fast and easy way to deploy Next.js, which you can deploy on 21 Cloud Box either as a static web page or as Node Server.

The difference between the two is that when deployed as a static web page, the process is that the project is built (packaged), and then the resulting static resources (HTML, CSS, JS, images, etc.) are deployed to CDN nodes across the country. When deployed in the way of Node Server, the process is to build the project first, deploy static resources to the CDN node in the national bamboo and wood water mouth, and then start the service to enter the state waiting to be accessed. When there is a service request, the server will process it.

You can now do this in practice:

Register as a 21 Cloud Box member

Fork Next.js example

Choose the following ways to deploy

Deployment environment static web page construction command yarn & & yarn build & & yarn next export release directory out

Deploy the environment Node 12.19 as a Node server build commands yarn & & yarn build release directory yarn next start-- port 10000

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Tags: Static service mode environment web page server project national function command process box directory node resource help support production clarity membership Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Shulou Technology Shulou Information MySQL Redmi