“connection failed: FATAL: no pg_hba.conf entry for host” Error while connecting pgadmin on LEMP

This problem occurs when your server is blocking incoming connections to your pgsql database. Before you try to solve it, find out the version of pgsql you have installed on the server.

Now we will be editing the pg_hba.conf file and allow incoming connections from all IPs (we can allow from only your IP but if you have a dynamic IP, it will cause trouble again)

Edit pg_hba.conf

Add the following line to allow connections from any IP address:

Edit postgresql.conf


Find and modify the listen_addresses line to:

After making changes to pg_hba.conf and postgresql.conf, restart the PostgreSQL service: