Why am I getting ERR_CONNECTION_TIMED_OUT when trying to reach my server?

Posted April 10, 2019 4.1k views

I am on a node.js one click droplet and after starting my project with node index.js, it appears as though the server is running but when I try to reach it in a browser with the ip address and port, I get ERRCONNECTIONTIMED_OUT. Not sure if theres more I have to configure or if a node js droplet is not the best option? Anything info would help. Below is my index.js of my project..

const express = require(‘express’);
const http = require('http’);
const bodyParser = require('body-parser’);
const morgan = require('morgan’);
const app = express();
const router = require(’./router’);
const mongoose = require('mongoose’);
// const config = require(’./config/config’);
const cors = require('cors’);
const dotenv = require('dotenv’);

const isLocal = process.env.NODEENV !== 'production’ && process.env.NODEENV !== 'development’;
const isDev = process.env.NODE_ENV !== 'production’;

// App Setup
app.use(morgan('combined’)); // logging framework
app.use(bodyParser.json({type: ’/’})); // parse incoming requests into json no matter type

// Server Setup
const port = process.env.PORT || 3001;
const server = http.createServer(app);
console.log(’\n\n\n\n\n\n\n\n\n\nServer listening on:’, port);

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Hi. I have the same problem. I have problem with my application configuration?

root@docker-s-1vcpu-2gb-nyc1-01:~# netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0* LISTEN 24667/./code-server
tcp 0 0* LISTEN 22671/node
tcp 0 0* LISTEN 608/systemd-resolve
tcp 0 0* LISTEN 1001/sshd
tcp 0 0* LISTEN 25880/node
tcp6 0 0 :::6379 :::* LISTEN 21689/docker-proxy
tcp6 0 0 :::22 :::* LISTEN 1001/sshd
udp 0 0* 608/systemd-resolve


The underlying cause could come from many directions, but the bottom line is that you’re not able to reach that port on that IP. These are some possible causes for that:

  • Firewall on your computer blocking outbound to that port
  • Firewall on your network/router blocking outbound to that port
  • Firewall on your droplet blocking inbound on that port
  • Our firewall product (if you use it) blocking inbound on that port
  • The application is not listening on the public interface
  • The application is not listening at all

You can check what the application is listening on with a command like this, to see what services are listening on your droplet:

netstat -tulpn

If it’s listening on anything other than or the public IP, then it’s application configuration. If it is listening on or the public IP, then it’s one of the first four options above.