R
R
retr02020-10-06 16:33:21
Nginx
retr0, 2020-10-06 16:33:21

Node.js Express app not working on Ubuntu Server host, how to fix?

I can not connect to the express server either through an external IP or through an internal one. Forwarding on the router is configured.

const sendToChat = (message, resp) => {
    console.log('Got Message')
    if (chatID != null) {
        bot.sendMessage(chatID, message);
        resp.send('OK');
    } else {
        resp.send('CHAT_ID_IS_NOT_CONFIGURED');
    }
}
app.get('/message', (req, res) => {
    sendToChat(req.query.msg, res);
});
app.listen(3000, "0.0.0.0", () => {
    //..
  })

When I try to connect both through an external IP and through an internal one, it says "Unable to connect to the site." It is noteworthy that the telegram bot written in the same application works properly, I can’t connect specifically to express. I also looked in the logs, no errors. By the way, Nginx is installed on the host, I run the application itself as a daemon through forever.js. Before installing Nginx, everything worked.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Official account of the Timeweb team, 2020-10-08
@timeweb_team

Since everything worked before installing Nginx, this is probably the problem. Perhaps after installing it by default, Nginx is accessed by IP. Try temporarily disabling Nginx on the host, or if it is indeed accessed first, set up proxying from Nginx to Node

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question