Answer the question
In order to leave comments, you need to log in
How to run a nodejs application correctly
The essence of the question is how to start the process (script) on the server.
The $node/path/main.js option doesn't roll as the process must always be running.
There is another option: use a supervisor. But it seems to me bone.
Use start-stop-daemon? there is a problem with require in scripts (apparently it is not possible to find the path to the modules that are installed for this project)
So how to “daemonize” a nodejs script?
Answer the question
In order to leave comments, you need to log in
works fine for me via supervisord
/etc/supervisor/conf.d/site.conf
[program:site]
command=/usr/local/bin/node app.js
directory=/var/www/site.com/www/current/
user=nobody
autostart=true
autorestart=true
startretries=3
stdout_logfile=/var/www/site.com/www/shared/log/server.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stderr_logfile=/var/www/site.com/www/shared/log/error.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stopsignal=TERM
environment=NODE_ENV=production
I am using the forever module - github.com/nodejitsu/forever
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question