简体   繁体   中英

OperationalError: could not connect to server: Permission denied tTCP/IP connections on port 5432?

I can able to connect postgres from terminal as well as python manage.py dbshell command

But when i'm trying to connect from apache i'm Getting error as follows.

Error : OperationalError: could not connect to server: Permission denied
Is the server running on host "192.168.1.10" and accepting 
TCP/IP connections on port 5432?

My listen Address on postgress conf file is 192.168.1.10 Address

pg_hg_cong allowed host all all 192.168.0.0/24 trust

And also selinux turned httpd_can_network_connect_db on

Port is listening on 192.168.1.10:5432 on netstat output.

And database's are storing in /tmp directory

wxrwxrwx.  1 postgres postgres     0 Dec 18 07:40 .s.PGSQL.5432
-rw-------.  1 postgres postgres    50 Dec 18 07:40 .s.PGSQL.5432.lock

Actually I have enabled selinux httpd_can_network_connect_db parameters on db server instead of web server

So issue got solved after enabling httpd_can_network_connect_db on web server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM