How to use Nginx to export the mongoDB connection?
- by Totty
I have on my server 2 things: the node.js server and a mongodb database; The node.js server is reachable from myip/server; and now I would like to export the mongodb database to myip/database for example.
Now when I use my mongodb viewer (MongoVUE) with "http://myip/database:9000" (the port 9000 is set in nginx and it's also the port that I start mongod). If I go to "http://myip/database:9000" or "http://myip/database" in a browser it look like: "You are trying to access MongoDB on the native driver port. For http diagnostic access, add 1000 to the port number".
But in MongoVUE it says:
Unable to connect to server 192.168.1.16/database:9000: No such host is known.
Type: MongoDB.Driver.MongoConnectionException
Stack: at MongoDB.Driver.Internal.DirectConnector.Connect(TimeSpan timeout)
at MongoDB.Driver.MongoServer.Connect(TimeSpan timeout, ConnectWaitFor waitFor)
at MongoDB.Driver.MongoServer.Connect(TimeSpan timeout)
at MongoDB.Driver.MongoServer.Connect()
at MangoUI.MMongo.FQlxNlJKqO74gYmXgZR4(Object )
at MangoUI.MMongo.Open(Boolean useSamus)
at MangoUI.MMongo.Open()
at MangoUI.ComNavTree.wJQdUqApCpjoC39P59n(Object )
at MangoUI.ComNavTree.ExpandMe(MTreeNode expand)
at MangoUI.ComNavTree.tree_BeforeExpand(Object sender, TreeViewCancelEventArgs e)
No such host is known
Type: System.Net.Sockets.SocketException
Stack: at System.Net.Dns.GetAddrInfo(String name)
at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
at System.Net.Dns.GetHostAddresses(String hostNameOrAddress)
at MongoDB.Driver.MongoServerAddress.ToIPEndPoint(AddressFamily addressFamily)
at MongoDB.Driver.MongoServerInstance.Connect(Boolean slaveOk)
at MongoDB.Driver.Internal.DirectConnector.Connect(TimeSpan timeout)