tommygallaher
tommygallaher

Reputation: 13

Where can I find my pg_hba.conf file (for django app on a2hosting)

I'm deploying my first ever website (it's a Python 3.7, Django 2.2.9 site on a2hosting) and I'm getting the following error when trying to run migrations.

django.db.utils.OperationalError: FATAL:  no pg_hba.conf entry for host "xx.xx.xxx.xx", user "xxxxxx", database "xxxxxx", SSL off

Googling around, I've gathered that I have to add an entry in the pg_hba.conf file for the particular user.

Problem is this is my first experience with Linux, and I can't seem to locate the pg_hba.conf file to test this solution.

Please, where can I find this file (relative to my approot)?

PS: I've successfully installed Postgresql and SSL for the site.

Upvotes: 0

Views: 493

Answers (1)

Jim Jones
Jim Jones

Reputation: 19623

Welcome to Stack Overflow.

Considering you have access to the database locally, just execute SHOW hba_file; using a client of your choice to see where your pg_hba.conf file is located.

SHOW hba_file;

              hba_file               
-------------------------------------
 /etc/postgresql/11/main/pg_hba.conf
(1 Zeile)

If you feel curious about other paths and variables, take a look at SHOW ALL; ;-)

Upvotes: 2

Related Questions