我刚刚在科学Linux的6.4版上安装了Bugzilla4.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连接数据库中的bug用户。
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中的bug用户名和密码是否与Postgres中的设置相匹配。
然而,奇怪的是,当我使用Wireshark查看本地主机时,在访问bugzilla主页时没有看到任何连接到PostgreSQL服务器的尝试。但是,如果我使用PostgreSQL连接到psql服务器,就会看到Wireshark中的连接。
编辑
我还发现bugzilla不会发电子邮件。正如Daniel Vérité指出的那样,这是一个selinux问题。我将httpd_can_sendmail和httpd_can_network_connect改为true,现在起作用了。
发布于 2014-01-19 23:05:45
根据错误消息:
错误:无法连接到服务器:权限被拒绝 服务器是否运行在主机"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
https://stackoverflow.com/questions/21220366
复制相似问题