Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I replaced the mongodb-10gen install with the Ubuntu package (mongodb-server, mongodb-client and dev).

apt-get install mongodb

Thereafter, I am now unable to connect to the REST interface, where it worked before.

Doing a wget to, I receive the following response:

Connecting to failed: Connection refused.

My previous /etc/mongodb.conf file had the following in:

#enable REST
rest = true

Adding it to the packaged conf file does not resolve the issue, not even after restarting.

I also tried changing the following with no effect:

# Disable the HTTP interface (Defaults to localhost:27018).
# nohttpinterface = true


# Disable the HTTP interface (Defaults to localhost:27018).
nohttpinterface = false

I have searched for days, and there doesn't seem to be anything on the Mongo site about a similar anomaly. If you have encountered a similar issue on Ubuntu Oneiric, please add your comments, even if you haven't found a solution to this issue.

share|improve this question
I removed the Ubuntu package (mongodb-server, mongodb-client and dev) apt-get install mongodb-10gen. Then I found this one actually runs on port 28017. The "# Disable the HTTP interface (Defaults to localhost:27018)" comment also does not appear in the 10gen /etc/mongodb.conf file – Ones and Zeroes Apr 10 '12 at 9:45
up vote 1 down vote accepted

First, don't use the Ubuntu packages - you will end up with an old version, in some cases very old (I have seen 1.2, 1.6 etc.). Use the 10gen packages, as of writing this you should get 2.0.4

Next, the HTTP interface defaults to +1000 from whatever your defined MongoDB port is, so if you were expecting it on 27018 then you would have had to set your MongoDB port to 26018. That seems like an odd choice. If you left the port settings as the defaults, then your normal port would be 27017 and the HTTP REST interface would be 28017 - have you mixed them up perhaps?

Finally, if you want to see what is listening on which port, use:

lsof -i | grep LISTEN

That will get you a list of all the open listening ports and their owning processes, add another pipe and grep for mongod to narrow it down even further.

share|improve this answer
The Ubuntu package actually has the words "Defaults to localhost:27018" in the /etc/mongodb.conf file. Perhaps its a typo. Whichever however, I agree, the Ubuntu packages are lacking. – Ones and Zeroes Apr 19 '12 at 8:21
that's interesting - I would expect that it's a typo, here's the official one: – Adam C Apr 19 '12 at 15:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.