node.js - Postgres debian server deploy error: no pg_hba.conf entry for host -


i've installed postgres on vpn (debian 7.0). if i'm running node.js server locally , connecting remote pg, works absolutely perfect.
when i'm repo vpn , trying run node.js server there, i'm receiving error:

error fetching client pool { [error: no pg_hba.conf entry host "111.111.11.111", user "postgres", database "production", ssl off] 

111.111.11.111 - ip of vpn, pg database , node.js server should running.

here pg_hba.conf

host all 222.222.222.2/24 trust # database administrative login unix domain socket local               postgres                                peer  # type  database        user            address                 method  # "local" unix domain socket connections local                                                   peer # ipv4 local connections: host                            127.0.0.1/32            md5 # ipv6 local connections: host                            ::1/128                 md5 # allow replication connections localhost, user # replication privilege. #local   replication     postgres                                peer #host    replication     postgres        127.0.0.1/32            md5 #host    replication     postgres        ::1/128                 md5 

222.222.222.2 - local machine ip address

you must config node.js use localhost (unix-socket), if use ip-address must add tou pg_hab.conf like:

host production postgres 111.111.11.111 trust 

but recommend use different user connect database security reasons, example:

host production nodejs-user 111.111.11.111 md5 

and create user "nodejs-user" in psql


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -