Activate postgresql TCP / IP connections

1

Greetings I have the following problem I have a server in the cloud where I have hosted my database in postgresql. Through my application in JAVA I can access my database from any point with Internet.

I am doing an application in php with the connection to the same database when I run the xampp and run in localhost I can access my database but when I upload it to my hosting it sends me the following error

 psql -h 107.170.158.89 -U postgres
 psql: could not connect to server: Connection refused
    Is the server running on host "107.170.158.89" and accepting
    TCP/IP connections on port 5432?

with JAVA it works, with php locally it also works but since my hosting does not work

my pg_hba is configured in the same way

# IPv4 local connections:
host    all             all             0.0.0.0/0               md5

is also activated in postgresql.conf

listen_addresses = '*'

I do not know what my database server is going through, it's in centos

    
asked by Carlos Alberto Diaz Minaya 22.08.2018 в 00:36
source

1 answer

0

Change the line:

# IPv4 local connections:
 host    all             all             0.0.0.0/0               md5

by:

# IPv4 local connections:
host    all             all             all               md5

And try downloading the firewall, it's not good practice but we'll see if it works and then just configure it

    
answered by 22.08.2018 в 00:45