将node.js + expressjs应用程序的NODE_ENV设置为ubuntu下的守护程序 [英] setting NODE_ENV for node.js + expressjs application as a daemon under ubuntu
问题描述
我让守护进程按照以下说明工作:
http://kevin.vanzonneveld.net/ techblog / article / run_nodejs_as_a_service_on_ubuntu_karmic /
但是,由于这将以开发模式启动应用程序,日志文件将被spam.io调试日志垃圾邮件发送。 >
我尝试将noDE_ENV设置为upstart-conf-file中的生产,但没有成功。
code> script
export HOME =/ root
export NODE_ENV = production
exec / usr / local / bin / node /where/yourprogram.js> > /var/log/node.log 2>& 1
结束脚本
didn'
尝试
exec NODE_ENV = production / usr / local / bin / node /where/yourprogram.js>>在/ etc /一个较小的用户,所以它是 exec sudo -u some-user NODE_ENV = production / usr / local / bin / node / where /yourprogram.js>> /var/log/node.log 2>& 1
由于它产生了另一个用户可能有另一个环境。我是这里的新手,但它适用于我。
i got the daemon working alright with these instructions:
http://kevin.vanzonneveld.net/techblog/article/run_nodejs_as_a_service_on_ubuntu_karmic/
but because this starts the application in DEVELOPMENT mode, the log file gets spammed with socket.io debug logs.
i tried setting the NODE_ENV to production in the upstart-conf-file but had no success.
script
export HOME="/root"
export NODE_ENV=production
exec /usr/local/bin/node /where/yourprogram.js >> /var/log/node.log 2>&1
end script
didn't work.
解决方案 Try
exec NODE_ENV=production /usr/local/bin/node /where/yourprogram.js >> /var/log/node.log 2>&1
In my setup I'm sudoing as a lesser user, so it's
exec sudo -u some-user NODE_ENV=production /usr/local/bin/node /where/yourprogram.js >> /var/log/node.log 2>&1
and since it's spawning off another user it probably has another environment. I'm a newbie here, but it works for me.
这篇关于将node.js + expressjs应用程序的NODE_ENV设置为ubuntu下的守护程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!