Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to deploy node.js apps on a Linux server?

I'm running 4 separate Node.js apps on a Linux server with different ports and a proxy in front.

As I'm (right now) the only user in the server, it doesn't matter where I place the apps and how to run them. Currently my apps stay under my home directory (~/app1/, ~/app2/, etc.).

So my question is: where should I place the apps so that they can be shared between multiple users? Is there a standard place similar to /var/www?

like image 665
jsalonen Avatar asked May 29 '12 13:05

jsalonen


People also ask

Can I run node js on Linux server?

Introduction. Node. js is an open-source JavaScript runtime environment for building server-side and networking applications. The platform runs on Linux, macOS, FreeBSD, and Windows.

How do I deploy a node js server?

STEP 1: Go to https://www.heroku.com/ and register. Before Proceeding any further, make sure you have installed the latest version of Git on your PC. STEP 3: Go to Getting Started on Heroku with Node. js and download the Heroku Cli for your system.


3 Answers

I use https://github.com/visionmedia/deploy to deploy my apps. It will create a /var/www/productname directory. Inside that directory you have source, current and shared. The shared directory has the log and pid files.

I found that a good directory structure so that's what I am using for all my projects.

like image 154
Pickels Avatar answered Oct 07 '22 20:10

Pickels


I run Apache in addition to Node.js on the same server, so I don't really like having applications for Apache and Node.js in the same directory. My Apache hosted applications go in the traditional /var/www/ path, and I put my Node.JS applications under /var/node/. This is due to some automation I have setup in both Apache (Dynamic Virtual Hosts) and Node.JS.

More information on my setup and automating Proxy and Apache deployment can be found here: How to use vhosts alongside node-http-proxy?

like image 13
Timothy Strimple Avatar answered Oct 07 '22 21:10

Timothy Strimple


If you are using AWS Elastic beans stack for Node JS application on Linux server, then it should be there in /var/app/current/ directory

like image 4
vikky MCTS Avatar answered Oct 07 '22 22:10

vikky MCTS