node.js - Hastebin 服务器的 NPM 保持运行

标签 node.js apache ssh npm server

我已将 hastebin 安装在/var/www/paste/hastebin/

要启动 NPM 服务器,我必须导航到 hastebin 位置,然后输入:

npm start

这会让服务器运行起来

# npm start

> haste@0.1.0 start /var/www/paste/hastebin/
> node server.js

info: compressed application.js into application.min.js
info: loading static document name=about, path=./about.md
info: listening on 0.0.0.0:7777
debug: loaded static document success=true

如果我断开与 ssh session 的连接,我将无法再访问 example:7777

断开连接后我该怎么做才能保持其运行。

最佳答案

为了保持 session 打开,我建议安装 screen

运行 screen 打开“幕后”的终端 session - 然后,一旦运行 npm start 命令,只需按 CTRL+AD 即可与 screen session “断开连接”。

现在该服务应该在后台运行。

希望这有帮助!

关于node.js - Hastebin 服务器的 NPM 保持运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27496823/

相关文章:

ssh - 如何在 pam_exec 脚本中访问 ssh UserEnvironment var

node.js - Heroku 不遵守 script.start 命令

apache - Docker 在子域上运行

r - devtools::install_git 通过 SSH

apache - 需要在 .htaccess 重写规则中转义 #(哈希/井号)字符

python - 从 Python 脚本重新加载 Apache

php - vagrant up 后出错

javascript - jest 如何模拟依赖项所需的模块?

node.js - DynamoDB BatchGet 总是给出 "The provided key element does not match the schema"

node.js - node.js 中是否存在从 child_process.spawn 消耗 stdout 的竞赛?