Dennis

Dennis

Planned

I need to test whether it's easy in Ploi to host Next JS and/or Nuxt JS projects easily.

seitenumbruch

seitenumbruch

· · Edited
·

Not sure if this is useful or not... But I am currently working with Nuxt JS (v2) and I don't find it particularly difficult to host Nuxt projects (using SSR) using Ploi. This is what I do:

(1) Create a new site with project type "None" and web directory "/".

(2) Alter deploy code like so:

cd /home/someuser/project.com
git pull origin master

npm i
npm run build

echo "🚀 Application deployed!"

(3) Alter Nginx config according/similar to NuxtJS Nginx example for Laravel Forge.

(4) In /home/someuser/ create file ecosystem.config.js:

module.exports = {
  apps: [
    {
      name: "project.com",
      exec_mode: "cluster",
      instances: "max",
      cwd: "./project.com",
      script: "./node_modules/nuxt/bin/nuxt.js",
      args: "start",
      env: {
        PORT: 3000,
      },
    },
  ],
}

(5) Deploy.

(6) SSH into server and run pm2 start ecosystem.config.js.

(7) In deploy code add pm2 reload "project.com":

cd /home/someuser/project.com
git pull origin master

npm i
npm run build
pm2 reload "project.com" # <-- this

echo "🚀 Application deployed!"

I am not sure if this is a good way to go about things... but it works for me.

3 total votes
Green17 Azurite Solutions SMIT.
SMIT.

SMIT.

·
·

@Dennis I can give you examples for 2 different deployment styles for Nuxt3.

  1. Build on server (basic)
  2. Build locally/remote (ci/cd) and only deploy the .output of Nuxt3
no votes yet
You may use @ to mention someone.

Test: Next JS & Nuxt JS hosting

14 total votes
  • Dennis moved item to board Planned

    1 year ago
  • Dennis moved item to project Site Level Requests

    1 year ago
  • Dennis created the item

    1 year ago