gpt4 book ai didi

python - 数据库连接错误: Centos 6/Apache 2. 4/Postgres 9.4/Django 1.9/mod_wsgi 3.5/python 2.7

转载 作者:行者123 更新时间:2023-11-29 20:10:52 25 4
gpt4 key购买 nike

我正在尝试启动并运行我的网站。一切似乎都工作正常,但是当我进入一个包含数据库写入的页面时 - 我得到这个:

[Wed Oct 19 09:53:12.319824 2016] [mpm_prefork:notice] [pid 12411] AH00173: SIGHUP received.  Attempting to restart
[Wed Oct 19 09:53:13.001121 2016] [ssl:warn] [pid 12411] AH01909: sXXX-XXX-XXX-XXX.secureserver.net:443:0 server certificate does NOT include an ID which matches the server name
[Wed Oct 19 09:53:13.003578 2016] [mpm_prefork:notice] [pid 12411] AH00163: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 mod_wsgi/3.5 Python/2.7.6 configured -- resuming normal operations
[Wed Oct 19 09:53:13.003590 2016] [core:notice] [pid 12411] AH00094: Command line: '/usr/local/apache/bin/httpd'
(XID fsf92m) Database Connect Error: Access denied for user 'leechprotect'@'localhost' (using password: YES)
[Wed Oct 19 09:53:17.637487 2016] [mpm_prefork:notice] [pid 12411] AH00169: caught SIGTERM, shutting down

此行显示用户“leechprotest”无法连接:

(XID fsf92m) Database Connect Error: Access denied for user 'leechprotect'@'localhost' (using password: YES)

但是我没有名为 leechprotect 的用户。 leechportect 是 MySQL 上的默认用户(我猜测),因为 MySQL 作为默认数据库安装在我的专用服务器上。

我的 Django settings.py 文件:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'prelaunch_db',
'USER': 'postgres_user',
'PASSWORD': 'XXXXXXXXXXXXXXX',
'HOST': 'localhost',
'PORT': '',
}
}

我已经知道我的数据库和整个网站可以在我家里的测试服务器上运行。我认为这可能是对 MySQL 和 PostgreSQL 的干扰。

非常感谢任何帮助。

编辑(禁用水蛭保护后):

[Wed Oct 19 11:40:24.000919 2016] [ssl:warn] [pid 14754] AH01909: sXXX-XXX-XXX-XXX.secureserver.net:443:0 server certificate does NOT include an ID which matches the server name
[Wed Oct 19 11:40:24.001851 2016] [suexec:notice] [pid 14754] AH01232: suEXEC mechanism enabled (wrapper: /usr/local/apache/bin/suexec)
[Wed Oct 19 11:40:24.001887 2016] [:notice] [pid 14754] ModSecurity for Apache/2.9.0 (http://www.modsecurity.org/) configured.
[Wed Oct 19 11:40:24.001892 2016] [:notice] [pid 14754] ModSecurity: APR compiled version="1.5.2"; loaded version="1.5.2"
[Wed Oct 19 11:40:24.001897 2016] [:notice] [pid 14754] ModSecurity: PCRE compiled version="8.38 "; loaded version="8.38 2015-11-23"
[Wed Oct 19 11:40:24.001900 2016] [:notice] [pid 14754] ModSecurity: LUA compiled version="Lua 5.1"
[Wed Oct 19 11:40:24.001903 2016] [:notice] [pid 14754] ModSecurity: LIBXML compiled version="2.9.2"
[Wed Oct 19 11:40:24.001905 2016] [:notice] [pid 14754] ModSecurity: Status engine is currently disabled, enable it by set SecStatusEngine to On.
[Wed Oct 19 11:40:25.001596 2016] [ssl:warn] [pid 14755] AH01909: sXXX-XXX-XXX-XXX.secureserver.net:443:0 server certificate does NOT include an ID which matches the server name
[Wed Oct 19 11:40:25.004276 2016] [mpm_prefork:notice] [pid 14755] AH00163: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 mod_wsgi/3.5 Python/2.7.6 configured -- resuming normal operations
[Wed Oct 19 11:40:25.004294 2016] [core:notice] [pid 14755] AH00094: Command line: '/usr/local/apache/bin/httpd -D SSL'
(XID 6jmrjj) Database Connect Error: Access denied for user 'leechprotect'@'localhost' (using password: YES)
[Wed Oct 19 11:40:31.847492 2016] [mpm_prefork:notice] [pid 14755] AH00169: caught SIGTERM, shutting down

编辑2:

我发现 Apache 在 cPanel 上预配置了重写功能:

这些行位于 httpd.conf 文件中:

RewriteEngine on
RewriteMap LeechProtect prg:/usr/local/cpanel/bin/leechprotect
Mutex file:/usr/local/apache/logs rewrite-map

我试图注释掉这些行,但 cPanel 只是重新生成默认文件。我查看了如何编辑,发现:

[root@sXXX-XXX-XXX-XXX]# /usr/local/cpanel/bin/apache_conf_distiller --update

据我所知,任何写在 <VirtualHost></VirtualHost> 之外的内容运行上述命令时永久保存标签。

这解决了数据库错误问题。但我仍然收到 500 服务器错误。所有其他错误日志消息都是相同的。

最佳答案

MySQL 和 PostgreSQL 都没有附带名为“leechprotect”的用户。但谷歌搜索指出,这个用户名 is related to cPanel - 可能值得阅读以了解发生了什么。之后您可能会考虑为您的项目目录停用它。

关于python - 数据库连接错误: Centos 6/Apache 2. 4/Postgres 9.4/Django 1.9/mod_wsgi 3.5/python 2.7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40138417/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com