skip to Main Content

I am completely a noob to Nuxt.js.

I have created a nuxt.js app without any custom server such as express. I would like to upload to my web server Plesk Onyx. How do I do this?

I read few different ways that this can be done such as using docker or just deploying it directly as stated here. I don’t know how to use docker so I chose that latter method and wasn’t successful.

Can anyone direct me how to deploy it nuxt app correctly on a web server such Plesk Onyx?

Let me know if you require further information.

Thank you.

2

Answers


  1. I did not check Plesk Onyx

    But I assume that Plesk Onyx gives you VPN with root access
    What you need to do is this

    VPN OS is ubuntu

    • access the vpn using ssh (read about putty if you like) or just ssh root@serverip
    • sudo apt update
    • sudo install nginx
    • cd ~
    • sudo curl -sL https://deb.nodesource.com/setup_10.x -o nodesource_setup.sh
    • sudo bash nodesource_setup.sh
    • sudo apt install nodejs
    • sudo vim /etc/nginx/sites-available/nuxt_config (Search about nuxtjs nginx configration)
    • sudo ln -s /etc/nginx/sites-available/nuxt_config /etc/nginx/sites-enable
    • sudo nginx -s reload (to reload your nginx settings)
    • cd /var/www/
    • mkdir nuxt-site && cd nuxt-site
    • install you nuxtjs files using git clone and run npm i and npm run build if you don’t have dist folder in your repo
    • install pm2 (read about PM2) npm i -g pm2
    • make sure that you are in the project folder and run sudo pm2 start --name YourApplicationName npm -- start

    PS: if you push any updates in the future you should pull it and then restart or reload your pm2 like sudo pm2 reload 0 where 0 is the index of your project in pm2 you can do pm2 list to see what index your project have <3

    Login or Signup to reply.
  2. you need to have server.js file in root directory and run with plesk node

    const express = require('express');
    const { Nuxt, Builder } = require('nuxt');
    
    const config = require('./nuxt.config.js');
    
    // Create new express app
    const app = express();
    
    // Listen to port 3000 or PORT env if provided
    app.listen(process.env.PORT || 3000);
    
    // Enable production mode
    config.dev = false;
    
    // Create instance of nuxt
    const nuxt = new Nuxt(config);
    
    // Add nuxt middleware
    app.use(nuxt.render);
    
    // Build on start
    // new Builder(nuxt).build().catch(err => {
    //   console.error(err);
    //   process.exit(1);
    // });
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search