cd /etc/postgresql/14/main/open file named postgresql.conf
add this line to that file
  listen_addresses = '*'
  port = 5432
  max_connections = 80
then open file named pg_hba.conf
  sudo nano pg_hba.confsudo nano pg_hba.conf
  host  all  all 0.0.0.0/0 md5
It allows access to all databases for all users with an encrypted password
restart your server
  sudo systemctl restart postgresql