我刚刚在Scientific Linux 6.4版本上安装了bugzilla-4.4.1,但在连接数据库(Pg版本8.4)时遇到问题。
当我尝试获取主页(index.cgi
)时,收到以下消息:
软件错误:
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:
host all all 127.0.0.1/32 md5
我可以使用以下命令连接到数据库中的错误用户psql
:
psql -h 127.0.0.1 -U bugs
运行checksetup.pl
似乎可以确认数据库已正确设置和配置:
...剪...
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
脚本指示服务器已正确设置:
[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中的错误用户名和密码与Postgres中的设置匹配。
然而,一件看起来很奇怪的事情是,当我用Wireshark查看localhost时,在访问bugzilla主页时没有看到尝试连接到PostgreSQL服务器的任何尝试。但是,如果使用来连接到PostgreSQL服务器psql
,则可以在Wireshark中看到连接。
编辑
我还发现bugzilla不会发送电子邮件。正如DanielVérité指出的那样,这实际上是一个selinux问题。我将httpd_can_sendmail和httpd_can_network_connect更改为true,现在可以使用了。
根据错误消息:
错误:无法连接到服务器:权限被拒绝
服务器是否在主机“ 127.0.0.1”上运行并接受端口5432上的TCP / IP连接?
尝试连接到IP地址时,权限被拒绝,这意味着本地安全策略拒绝了该权限。必须启用Web服务器以使用以下命令连接到数据库:
setsebool -P httpd_can_network_connect_db 1
如果还不够:
setsebool -P httpd_can_network_connect 1
有关更多信息,请参见http://wiki.centos.org/TipsAndTricks/SelinuxBooleans
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句