DEV Community

1

Deloy Next or React App to VPS

Step by Step how to deploy next or react application to vps

  1. Login to your VPS

ssh user@hostname

  1. Generate SSH public key and add it to your GitHub project
    cat ~/.ssh/id_rsa.pub

  2. Clone the project to your VPS
    clone git@github.com:username/project.git
    cd project

  3. Install all necessary packages
    npm install
    npm run build
    npm install pm2 --save-dev
    npx pm2 start npm --name my-project -- start -- --port=3001
    npx pm2 restart my-project
    npx pm2 save

  4. Visit the application on the provided port
    https://hostname:3001

Congratulations Your Website is live!

Note: There are some necessary adjustments you need to make based on the type of OS and application on the VPS.

@abdulsalamamtech #vps #deploy #next #react

Top comments (0)

nextjs tutorial video

Youtube Tutorial Series ๐Ÿ“บ

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series ๐Ÿ‘€

Watch the Youtube series

๐Ÿ‘‹ Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someoneโ€™s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay