How do I "run server.js file through SSH commands" in my nginx server

Posted December 2, 2019 3.7k views

Hello, and thanks for your time.

I am very new to cloud and there are a lot of things I don’t understand.

We bought a wordpress theme that has a chat integrated with node and

I already created my droplet with LEMP and installed wordpress and node.js but according to the theme’s documentation I need to run a server.js file that the theme has on it’s files.


Can someone please help me out? I’ve been googling for 2 days now but I don’t think i’m typing the right querys because i would’ve found the answer by now.

You can just point me in the right direction and I will find the answer if you like :D


edited by bobbyiliev

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer


Indeed the instructions are not very clear.

What you need to do is:

  • SSH to your Droplet

  • Then cd to the directory of your theme:

cd /var/www/html/wp-content/themes/name-of-your-theme/js

Note that you would need to adjust the path in case that your website is not stored at the /var/www/html folder and also adjust the name of your theme part.

  • Then to run the server.js file just run:
node server.js

The problem with that approach is that as soon as you close your SSH session the process would stop. So what I could suggest instead is to use PM2, you could take a look at this tutorial here on how to do that:

Hope that this helps!

by Brennen Bearnes
Node.js is an open source JavaScript runtime environment for easily building server-side and networking applications. Node.js applications can be run at the command line but this guide focuses on running them as a service using PM2, so that they will automatically restart on reboot or failure, and can safely be used in a production environment.