Question

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

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 socket.io.

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.

(https://amentotech.ticksy.com/article/14850/)

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

Thanks


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello,

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:

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04

Hope that this helps! Regards, Bobby