I got acquainted with the node quite recently and after php everything goes around, so do not scold.

I start the server:

user@host: sudo nodejs server.js Server running at http://localhost:8080/ 

Server code:

 const http = require('http'); const hostname = 'localhost'; const port = 8080; const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello World\n'); }); server.listen(port, hostname, () => { console.log(`Server running at http://${hostname}:${port}/`); }); 

And it is logical that the server started on LAN: user @ host: curl localhost: 8080 Hello World

When the hostname changes to a domain, the console issues: Server running at http://moidomen.com:8080/ Only when accessing moidomen.com:8080, after a couple minutes of loading, the browser displays ERR_CONNECTION_TIMED_OUT What am I doing wrong? :)

  • The domain conducts on that computer on which you launch? - andreymal
  • moidomen.ru port 8080 at domain moidomen.ru open? - mix

0