简体   繁体   中英

Database Connect Error: Centos 6 / Apache 2.4 / Postgres 9.4 / Django 1.9 / mod_wsgi 3.5 / python 2.7

I am trying to get my website up and running. Everything seems to work fine, but when I go to a page with a database write - I get this:

[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

This line shows that a user "leechprotest" cannot connect:

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

However I don't have a user called leechprotect. leechportect is a default user on MySQL (im guessing), because MySQL is installed as the default database on my dedicated server.

My Django settings.py file:

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

I already know my database and entire site works on my test server at home. I think it might be interference with MySQL and PostgreSQL.

Any help much appreciated.

EDIT (After disabling leech protection):

[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

EDIT 2:

I found that Apache comes preconfigured on cPanel with a rewrite function:

These lines are in the httpd.conf file:

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

I tried to comment out these lines, but cPanel just regenerates the default file. I looked how to edit and I found:

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

From what I see, anyting written outside the <VirtualHost></VirtualHost> tag with be permanently saved when running the above command.

this got rid of the Database error problem. But I still get a 500 server error. And all other error log messages are the same.

MySQL and PostgreSQL both do not come along with a user called 'leechprotect'. But a google search points out, that this username is related to cPanel - might be worth reading that to understand whats going on. Afterwards you might consider deactivating it for you project directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM