How to accept the connection from remote host on PostgreSQL?
I use the postgresql with tomcat, related articles are PostgreSQL JDBC Driver on tomcat8 - Shammerism and Test connecting PostgreSQL DB from tomcat8 - Shammerism, but these article is the case that tomcat and postgresql are running on the same host. But, there is a case that users hopes to separate them. But, postgresql default configuration doesn't accept the remote connection.
Adding a follow line to /etc/postgresql/X.X/main/pg_hba.conf for enabling remote connection.
host all all 10.0.0.0/8 password
This means:
- Users can connect this postgresql with their account and password
- Users can connect if they are located in 10.0.0.0/8 network.
The file pg_hba.conf has more detail description.