node.jsnuxt.jsopenlitespeed

How is Nuxtjs started on openlitespeed with Nodejs? Startup file example


Trying to upload my project to openlitespeed. However, encountering difficulties.

Basic Node setup is that:

const http = require('http');

const hostname = '127.0.0.1';
const port = 3000;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello World form node js app.js\n');
});

server.listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);
});

Have a look at how to include Modules as below:

var http = require('http');
var dt = require('./myfirstmodule');

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/html'});
  res.write("The date and time are currently: " + dt.myDateTime());
  res.end();
}).listen(8080);

But, I can basicly run my Nuxtjs project on local host.

What is the possible expected result:

Running Nuxtjs application on VPS which is upcloud with a startup file for having seen serving it on openlitespeed.

Have checked here, but no info on openlitespeeed deployment: https://nuxtjs.org/docs/2.x/deployment/nginx-proxy


Solution

  • Hi it was pretty easy after some research:

    https://nuxtjs.org/docs/2.x/deployment/deployment-pm2

    copy this file named ecosystem.config.js file in which it has these codes to Root folder of Nuxt:

    module.exports = {
        apps: [
          {
            name: 'NuxtAppName',
            exec_mode: 'cluster',
            instances: 'max', // Or a number of instances
            script: './node_modules/nuxt/bin/nuxt.js',
            args: 'start'
          }
        ]
      }
    

    Run on your linux:

    killall node
    cd /usr/local/lsws/serverclient/client
    pm2 start
    

    Good to go