Open Port in Ubuntu

If you have edited postgresql.conf and main/pg_hba.conf and still having a problem, please try

sudo ufw allow 5432/tcp

to unblock psql port


It works for me the last method (thks Julio):

Edit: postgresql.conf

sudo nano /etc/postgresql/9.3/main/postgresql.conf

Enable or add:

listen_addresses = '*'

Restart the database engine:

sudo service postgresql restart


Besides, you can check the file: pg_hba.conf

sudo nano /etc/postgresql/9.3/main/pg_hba.conf

And add your network or host address:

host all all 192.168.1.0/24 md5


Edit /etc/postgresql/<version>/main/postgresql.conf and set the listen_addresses to your outgoing interface or all. Restart postgresql: sudo service postgresql restart.