pm2 service to manage nuxt application.
Create ecosystem.config.json
.
module.exports = {
apps: [
{
name: 'app_name',
exec_mode: 'cluster',
instances: 'max',
script: './node_modules/nuxt/bin/nuxt.js',
args: 'start'
}
]
}
Now run usepm2
command.
You can also create app.js
.
require('pm2')
require('child_process').fork(require.resolve('pm2/bin/pm2'), ['start'], {
stdio: 'inherit'
})