By default, PostgreSQL is configured to listen on the local address only. To enable access remotely we need to tell PostgreSQL to “listen” on the public facing address. With elevated privileges, we need to modify the postgresql.conf.
> sudo nano postgresql.conf
In the “CONNECTIONS AND AUTHENTICATION” section, you should see a key value pair like this one
#listen_addresses = ‘localhost’
We need to uncomment that setting and add the public ip of your server or open it up completely.
listen_addresses = ‘*’
listen_addresses = ‘localhost’,’192.168.1.1′
When you are ready, restart the server to start the server listening on other IPs.
> sudo service postgresql restart
Once the server has restarted, you should be able to access the database remotely.