[英]How to set up my Ubuntu nodeJS server, and upload my angularJS WebSites
[英]How to set up a nodejs application server in ubuntu
我不明白為什么會有這個問題,我將在第二部分中顯示輸出。 在遵循教程“如何在Ubuntu 14.04上為生產設置Node.js應用程序”時,我做了所有事情。
我創建了一個腳本來測試我的私有IP地址,如下所示
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(8080, 'myPrivateIp');
console.log('Server running at http://myPrivateIp:8080/');
我在測試附件時遇到的問題。
JoeDoe@myUbuntu:~$ node hello.js
Server running at http://myPrivateIp:8080/
events.js:141
throw er; // Unhandled 'error' event
^
Error: listen EADDRNOTAVAIL myPrivateIp:8080
at Object.exports._errnoException (util.js:837:11)
at exports._exceptionWithHostPort (util.js:860:20)
at Server._listen2 (net.js:1218:19)
at listen (net.js:1267:10)
at net.js:1376:9
at doNTCallback3 (node.js:440:9)
at process._tickCallback (node.js:346:17)
at Function.Module.runMain (module.js:477:11)
at startup (node.js:117:18)
at node.js:951:3
listen
的第二個參數不是域名,而是要監聽的地址。 可能是192.168.xx
或127.0.0.1
或0.0.0.0
(表示所有地址。)。 默認值為127.0.0.1
。
這意味着您應該刪除listen
的第二個參數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.