How to config mongo on a remote server? I have two servers, one for app(rails) and one for db(mongo).My rails config for mongo will be like this(yaml file):

hosts:
  - xxx.xxx.xxx.xxx:57777
database: admin
username: root
password: some_password


So.. how can I configure on the mongo server including the 57777 port, password for root user?
For the port you need to start mongod with parameter --port 57777 . Alternative place it on the configuration file under 

net:
   port: 57777

For the username and password part you need to enable security by start  mongod with parameter--auth . Alternative place it on the configuration file under security.authorization = enable
Then you can create the username:root assign a password and certain privileges.

More can be found here: http://docs.mongodb.org/manual/core/authorization/