我可以从终端以及python manage.py dbshell命令连接postgres
但是,当我尝试从apache连接时,出现如下错误。
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?
我在postgress conf文件上的监听地址是192.168.1.10地址
pg_hg_cong允许主机所有192.168.0.0/24信任
并且selinux开启了httpd_can_network_connect_db
端口正在netstat输出的192.168.1.10:5432上侦听。
数据库存储在/ tmp目录中
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
实际上我已经在数据库服务器而不是Web服务器上启用了selinux httpd_can_network_connect_db参数
因此,在Web服务器上启用httpd_can_network_connect_db后,问题得到解决
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句