Reputation: 1496
I stopped IIS on Windows Server 2019 completely, and Im serving my NodeJS app on port 80 as follows:
const express= require('express');
const app=express();
...
...
...
const hostname = '0.0.0.0';
const port = 80;
app.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
But Node is not serving remotely. It works with localhost:80
Ive set hostname = '0.0.0.0' based on an answer I've found here at StackOverflow. The server's public IP doesn't work either.
When turning IIS on and setting up the site, I can see an index.html file just fine, so port 80 works.
Is it a server issue, or a node.js issue?
Im starting node with
node index.js
Thanks.
Upvotes: 3
Views: 1673
Reputation: 1496
For those facing this issue, I fixed it up as Tadman recommended on the above comments: configuring IIS for forwarding (by installing the Application Request Routing and the URL rewrite extensions to IIS).
Node.js also worked when creating a new rule at Windows firewall for enabling port 80. The default rule at the firewall for port 80 will work only with IIS, not with Node.js.
As for the extensions mentioned above, here is a good instructive about how to install and setup:
Upvotes: 3