我有一臺linux服務器(ubuntu)並安裝了node.js.關閉終端後的網絡服務器
我的腳本:webserver.js:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(80);
console.log('Server is running');
我連接到服務器用膩子啓動服務器腳本: 節點webserver.js
它的工作原理。但是,如果我關閉終端,則Web服務器將終止。我該如何解決這個問題?
[Node.js作爲後臺服務]的可能重複(http://stackoverflow.com/questions/4018154/node-js-as-a-background-service) – moka