0
我很難過。無法連接到簡單節點上的端口Js服務器
我有一個節點js服務器在子域上運行。
每當我嘗試從瀏覽器訪問它時,我都會收到ERR_CONNECTION_REFUSED錯誤。
這裏是我的服務器代碼
const http = require('http');
http.createServer(function (request, response){
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
}).listen(8124, "my-server-ip");
console.log('Server running at http://127.0.0.1:8124/');
附加信息: 我正在與HostGator的一個VPS。 子域與主域共享一個IP;像412.x.xx.xxx。
在控制檯中沒有錯誤,像'createServer被棄用'或什麼? – adeneo
你確定沒有別的東西在使用那個端口嗎? – xkcd149
控制檯中沒有錯誤消息。 – user5819430