DEV Community

Setup a Next.js project with PM2, Nginx and Yarn on Ubuntu 18.04

react-stockholm on February 10, 2020

So, I recently had to deploy a Next.js project to a Ubuntu-server. Quite straight forward but you might run into some quirks. We tend to deploy o...
Collapse
 
dance2die profile image
Sung M. Kim

Hi @react-stockholm

We encourage the entire article to be published on DEV.to (if you have proper rights), with a link back if appropriate. Otherwise, we recommend original material, such as original commentary on the article. From the Terms of Use:

Users must make a good-faith effort to share content that is...not designed primarily for the purposes of promotion or creating backlinks. Additionally, posts must contain substantial content — they may not merely reference an external link that contains the full post.

Posts that are simply intended to encourage readers to view an external resource are discouraged.

Thank you.

Collapse
 
reactstockholm profile image
react-stockholm

Ill make sure to post the whole article here :)

Collapse
 
r1si profile image
Elia "r1si" Baragiola

With this pm2 setup, will don't works the ENV configs.
Use this insteed:
github.com/vercel/next.js/discussi...

The only "bug" open is the app version... (with my config will show nextjs version)

Collapse
 
danielsdesk profile image
danielsdesk

is the --interpreter bash flag necessary? I've never seen this need to be used when running next.js with pm2 before

Collapse
 
mittalyashu profile image
Yashu Mittal • Edited

In the recent version of pm2 (as of this date), you don't need to use --interpreter flag.

You can directly use pm2 start "yarn server".