1 Answer
- Newest
- Most votes
- Most comments
1
You cannot use your global IP or your public DNS name as your hostname
, but you can set hostname
to 0.0.0.0
to serve your app globally.
const http = require("http"); const hostname = "0.0.0.0"; const port = 8000; const server = http.createServer((req, res) => { res.writeHead(200, { "Content-Type": "text/plain" }); res.end("Hello World\n"); }); server.listen(port, hostname, () => { console.log(`Server running at http://${hostname}:${port}/`); });
answered 7 months ago
Relevant content
- I host a website on an EC2 instance. How do I allow my users to connect on HTTP (80) or HTTPS (443)?AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 8 months ago