title: Can't connect Node.js to Mongodb
body: <p>I'm newbie about node.js and MongoDB.</p>
  
  <p>I have installed MongoDB on a server A. MongoDB is running and port 27017 is opened. I am able to connect to robo3T</p>
  
  <p>I have a Node.js app on another server B. Node.js is running.</p>
  
  <p>When I access the website, everything is displayed correctly but when I want to login (so it needs MongoDB access), the website turns and get this error: Cannot GET /502.shtml</p>
  
  <p>Here are all details</p>
  
  <p>Mongodb server
   mongod.conf :</p>
  
  <pre><code>port: 27017
  bindIp: 0.0.0.0 
  </code></pre>
  
  <p>Nodejs app.js:</p>
  
  <pre><code>    var promise = mongoose.connect('mongodb://XXXX:27017/preprod', {useMongoClient: true}, function(err) {
      if (err) return console.error(err);});
  mongoose.Promise = require('bluebird');
  </code></pre>
  
  <p>XXXX = address IP of server A (mongodb server)</p>
  
  <p>when I run app.js I got this error</p>
  
  <pre><code>name: 'MongoError',
    message: 'failed to connect to server [XXX:27017] on first connect [MongoError: connect ETIMEDOUT XXXX:27017]' }
  </code></pre>
  
  <p>I am able to connect from my linux machine, other VPS server but not to my nodejs server!</p>
  
  <p>Maybe I missed something?</p>