首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >bugzilla无法连接postgres服务器

bugzilla无法连接postgres服务器
EN

Stack Overflow用户
提问于 2014-01-19 17:48:42
回答 1查看 1K关注 0票数 2

我刚刚在科学Linux的6.4版上安装了Bugzilla4.4.1,我在连接数据库(Pg版本8.4)时遇到了问题。

当我尝试获取主页(index.cgi)时,我会得到以下消息:

软件错误:

代码语言:javascript
复制
Can't connect to the database.
Error: could not connect to server: Permission denied
    Is the server running on host "127.0.0.1" and accepting
    TCP/IP connections on port 5432?
  Is your database installed and up and running?
  Do you have the correct username and password selected in localconfig?

For help, please send mail to the webmaster (root@localhost), giving this error message and the time and date of the error.

Postgres的pg_hba.conf.conf配置为本地主机上的md5 auth:

代码语言:javascript
复制
host all all 127.0.0.1/32 md5

我可以使用psql连接数据库中的bug用户。

代码语言:javascript
复制
psql -h 127.0.0.1 -U bugs

运行checksetup.pl似乎可以确认数据库的设置和配置是否正确:

..。狙击..。

代码语言:javascript
复制
Reading ./localconfig...
Checking for               DBD-Pg (v2.7.0)    ok: found v2.15.1 
Checking for           PostgreSQL (v8.03.0000) ok: found v08.04.1800 

Removing existing compiled templates...
Precompiling templates...done.
Fixing file permissions...

Now that you have installed Bugzilla, you should visit the 'Parameters'
page (linked in the footer of the Administrator account) to ensure it
is set up as you wish - this includes setting the 'urlbase' option to
the correct URL.
checksetup.pl complete.
[root@PAHRALBLNX001 bugzilla]# 

testserver.pl脚本指示服务器已正确设置:

代码语言:javascript
复制
[root@PAHRALBLNX001 bugzilla]# ./testserver.pl http://127.0.0.1/
TEST-OK Webserver is running under group id in $webservergroup.
TEST-OK Got padlock picture.
TEST-OK Webserver is executing CGIs via mod_cgi.
TEST-OK Webserver is preventing fetch of http://127.0.0.1/localconfig.

我还验证了localconfig中的bug用户名和密码是否与Postgres中的设置相匹配。

然而,奇怪的是,当我使用Wireshark查看本地主机时,在访问bugzilla主页时没有看到任何连接到PostgreSQL服务器的尝试。但是,如果我使用PostgreSQL连接到psql服务器,就会看到Wireshark中的连接。

编辑

我还发现bugzilla不会发电子邮件。正如Daniel Vérité指出的那样,这是一个selinux问题。我将httpd_can_sendmail和httpd_can_network_connect改为true,现在起作用了。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-01-19 23:05:45

根据错误消息:

错误:无法连接到服务器:权限被拒绝 服务器是否运行在主机"127.0.0.1“上并接受端口5432上的TCP/IP连接?

当试图连接到IP地址时,权限被拒绝,这意味着它被本地安全策略拒绝。必须启用web服务器才能使用以下命令连接到数据库:

代码语言:javascript
复制
setsebool -P httpd_can_network_connect_db 1

如果这还不够:

代码语言:javascript
复制
setsebool -P httpd_can_network_connect 1

有关更多信息,请参见http://wiki.centos.org/TipsAndTricks/SelinuxBooleans

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21220366

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档