apache2: configuration of mod_dav, mod_dav_fs - configuration

On a mountpoint (specifically: /var/data/) I have mounted a 3tb raid partition that stores all kind of data and I would like to share it through WebDAV. So I installed davfs2 on my client and set up the server site by adding:
ScriptAlias "/var/www/webdav" "/var/data"
<Directory "/var/www/webdav">
Dav On
</Directory>
Finally I added the www-data user to the media group, which is the group that has read/write access to all the /var/data stuff (file mode for all contents is 660, chown is "some_owner_which_is_part_of_media:media").
Then a a2enmod mod_dav and a restart of the apache should arise it to life. Ok, fine until here. I mounted the davfs on my client pc and it worked like a glance. At least it looked like that. The contents were listed and I was happy. Later I tried to open some file on my client, but sadly it failed with an IO error. And here the problems begin.
==> /var/log/apache2/access.log <==
jin.local - - [26/Jun/2010:14:04:45 +0200] "PROPFIND /webdav/ HTTP/1.1" 207 25152 "-" "davfs2/1.4.5 neon/0.29.0"
jin.local - - [26/Jun/2010:14:04:46 +0200] "GET /webdav/test HTTP/1.1" 500 823 "-" "davfs2/1.4.5 neon/0.29.0"
==> /var/log/apache2/error.log <==
[Sat Jun 26 14:04:46 2010] [error] [client 192.168.2.50] (13)Permission denied: exec of '/var/data/test' failed
[Sat Jun 26 14:04:46 2010] [error] [client 192.168.2.50] Premature end of script headers: test
In the assumption it might be a problem with the permissions that apache2 has no right to access this stuff I swiftly chowned the files and therefore I am quite sure it must be fine like this:
# ls -la /var/data
-rw-r--r-- 1 www-data www-data 22 2010-06-27 10:07 anotherTest
-rw-r--r-- 1 www-data www-data 5 2010-06-26 19:28 test
# cat anotherTest
this is another test
# cat test
test
Lately I also added authentication, in case WebDAV could need that to allow me the GET request. The authentication works but the rest just stays the same.
At this point I don't know what I could change. Anyone got an idea what I could try?
Greetings,
D.
-- EDIT --
some more log stuff and the current configuration. i just dont get what is wrong with it. as you can see in the log i can create (PUT) and delete (DELETE) files. but get just doesnt work.
ScriptAlias /webdav/ /test/
<Location /webdav/>
DAV On
AuthType Basic
AuthName "Restricted Files"
AuthBasicProvider file
AuthUserFile /var/www/passwords
AuthGroupFile /var/www/groups
<LimitExcept PROPFIND>
require group webdav
</LimitExcept>
</Location>
This is so odd?!
192.168.2.158 - - [02/Jul/2010:21:11:38 +0200] "GET /webdav/test HTTP/1.1" 500 823 "-" "-"
192.168.2.158 - - [02/Jul/2010:21:11:38 +0200] "GET /webdav/test HTTP/1.1" 500 823 "-" "-"
192.168.2.158 - dominik [02/Jul/2010:21:11:39 +0200] "PROPFIND /webdav/ HTTP/1.1" 207 1882 "-" "-"
192.168.2.158 - - [02/Jul/2010:21:11:39 +0200] "GET /webdav/test HTTP/1.1" 500 823 "-" "-"
192.168.2.158 - - [02/Jul/2010:21:11:39 +0200] "GET /webdav/test HTTP/1.1" 500 823 "-" "-"
192.168.2.158 - - [02/Jul/2010:21:11:39 +0200] "GET /webdav/test HTTP/1.1" 500 823 "-" "-"
192.168.2.158 - dominik [02/Jul/2010:21:11:42 +0200] "PROPFIND /webdav/.test.swp HTTP/1.1" 404 467 "-" "-"
192.168.2.158 - dominik [02/Jul/2010:21:11:42 +0200] "PUT /webdav/.test.swp HTTP/1.1" 201 481 "-" "-"
192.168.2.158 - dominik [02/Jul/2010:21:11:42 +0200] "DELETE /webdav/.test.swp HTTP/1.1" 204 141 "-" "-"
192.168.2.158 - dominik [02/Jul/2010:21:11:45 +0200] "PROPFIND /webdav/ HTTP/1.1" 207 497 "-" "-"
==> /var/log/apache2/private-error.log <==
[Fri Jul 02 21:11:38 2010] [error] [client 192.168.2.158] (13)Permission denied: exec of '/test/test' failed
[Fri Jul 02 21:11:38 2010] [error] [client 192.168.2.158] Premature end of script headers: test
[Fri Jul 02 21:11:38 2010] [error] [client 192.168.2.158] (13)Permission denied: exec of '/test/test' failed
[Fri Jul 02 21:11:38 2010] [error] [client 192.168.2.158] Premature end of script headers: test
[Fri Jul 02 21:11:39 2010] [error] [client 192.168.2.158] (13)Permission denied: exec of '/test/test' failed
[Fri Jul 02 21:11:39 2010] [error] [client 192.168.2.158] Premature end of script headers: test
[Fri Jul 02 21:11:39 2010] [error] [client 192.168.2.158] (13)Permission denied: exec of '/test/test' failed
[Fri Jul 02 21:11:39 2010] [error] [client 192.168.2.158] Premature end of script headers: test
[Fri Jul 02 21:11:39 2010] [error] [client 192.168.2.158] (13)Permission denied: exec of '/test/test' failed
[Fri Jul 02 21:11:39 2010] [error] [client 192.168.2.158] Premature end of script headers: test

I could bang my head. The solution was simple:
Alias /webdav/ /var/data/
<Location /webdav/>
DAV On
AuthType Basic
AuthName "Restricted Files"
AuthBasicProvider file
AuthUserFile /etc/passwords
AuthGroupFile /etc/groups
<LimitExcept PROPFIND>
require group webdav
</LimitExcept>
</Location>
Note the "Alias" in the place of "ScriptAlias". The reason why this works can be found here.

Related

HTTP ERROR 500 - domain is unable to handle this request

I am running my application on my local using Laragon. Upon running my app, it says HTTP ERROR 500 - domain is unable to handle this request. Now, this error is too generic so I've checked my apache error log file but there is nothing substantial with the message:
[Wed Dec 29 11:09:19.659652 2021] [core:warn] [pid 15608:tid 640] AH00098: pid file C:/laragon/bin/apache/httpd-2.4.47-win64-VS16/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Wed Dec 29 11:09:19.662662 2021] [mpm_winnt:notice] [pid 15608:tid 640] AH00455: Apache/2.4.47 (Win64) OpenSSL/1.1.1k mod_fcgid/2.3.10-dev configured -- resuming normal operations
[Wed Dec 29 11:09:19.662662 2021] [mpm_winnt:notice] [pid 15608:tid 640] AH00456: Apache Lounge VS16 Server built: Apr 24 2021 11:08:47
[Wed Dec 29 11:09:19.662662 2021] [core:notice] [pid 15608:tid 640] AH00094: Command line: 'C:\\laragon\\bin\\apache\\httpd-2.4.47-win64-VS16\\bin\\httpd -d C:/laragon/bin/apache/httpd-2.4.47-win64-VS16'
[Wed Dec 29 11:09:19.664662 2021] [mpm_winnt:notice] [pid 15608:tid 640] AH00418: Parent: Created child process 11520
[Wed Dec 29 11:09:20.146271 2021] [mpm_winnt:notice] [pid 11520:tid 572] AH00354: Child: Starting 64 worker threads.
On my ht.access:
Options -Indexes
# Deny accessing below extensions
<Files ~ "(.json|.lock|.git|.key)">
Order allow,deny
Deny from all
</Files>
# Deny accessing dot files
RewriteRule (^\.|/\.) - [F]
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) http://%{SERVER_NAME}/$1 [R,L]
I've looked through many solutions here but it does not solve my problem. I found a workaround that is to add error_reporting(0) to my index.php that solves this problem and the app will run normally although I don't think this is an ideal solution.
Is there any possible way I could dig more to find the cause of this issue other than turning off the error reporting?

Compromised DigitalOcean droplet routing strange traffic

I have a DigitalOcean Ubuntu 16.04 droplet with pre-installed Wordpress. It has SSH login
enabled with root and password login disabled. UFW is enabled.
Not a security expert and only a novice webdev but it seems it has been compromised.
I think this occured because I disabled 'strict SQL mode' as per this tutorial:
https://serverpilot.io/community/articles/how-to-disable-strict-mode-in-mysql-5-7.html
I had a second Wordpress install to install on the server and could only do it with
strict mode disabled. I didn't re-enable it once I completed the install.
Here is an excerpt from the Apache2 error.log file:
[Mon Dec 05 10:32:51.819437 2016] [:error] [pid 15466] [client 172.68.10.110:26708] PHP Warning: mysqli_query(): MySQL server has gone away in /var/www/html/wp-includes/wp-db.php on line 1868
[Mon Dec 05 10:32:51.821173 2016] [:error] [pid 15466] [client 172.68.10.110:26708] PHP Warning: mysqli_query(): Error reading result set's header in /var/www/html/wp$
[Mon Dec 05 10:32:51.819142 2016] [:error] [pid 4570] [client 66.249.79.102:64614] PHP Warning: mysqli_query(): MySQL server has gone away in /var/www/html/wp-include$
[Mon Dec 05 10:32:51.821877 2016] [:error] [pid 4570] [client 66.249.79.102:64614] PHP Warning: mysqli_query(): Error reading result set's header in /var/www/html/wp-$
[Mon Dec 05 10:32:51.819998 2016] [:error] [pid 3981] [client 173.245.55.78:35305] PHP Warning: mysqli_query(): MySQL server has gone away in /var/www/html/wp-include$
[Mon Dec 05 10:32:51.822283 2016] [:error] [pid 3981] [client 173.245.55.78:35305] PHP Warning: mysqli_query(): Error reading result set's header in /var/www/html/wp-$
[Mon Dec 05 15:12:58.198942 2016] [core:error] [pid 17194] (36)File name too long: [client 66.249.79.104:58168] AH00036: access to /read-online-psychedelic-research-in$
[Mon Dec 05 23:02:30.550613 2016] [core:error] [pid 20194] (36)File name too long: [client 66.249.79.98:51473] AH00036: access to /read-online-peoples-temple-including$
[Tue Dec 06 04:15:03.795417 2016] [core:error] [pid 21882] (36)File name too long: [client 66.249.79.98:53902] AH00036: access to /novels-by-tad-williams-including-the$
[Tue Dec 06 07:47:20.068192 2016] [mpm_prefork:notice] [pid 1475] AH00169: caught SIGTERM, shutting down
[Tue Dec 06 07:47:21.097262 2016] [mpm_prefork:notice] [pid 23589] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Tue Dec 06 07:47:21.097393 2016] [core:notice] [pid 23589] AH00094: Command line: '/usr/sbin/apache2'
[Tue Dec 06 07:54:16.190667 2016] [mpm_prefork:notice] [pid 23589] AH00169: caught SIGTERM, shutting down
[Tue Dec 06 07:54:32.918723 2016] [mpm_prefork:notice] [pid 1525] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Tue Dec 06 07:54:32.934492 2016] [core:notice] [pid 1525] AH00094: Command line: '/usr/sbin/apache2'
[Tue Dec 06 07:55:51.504685 2016] [mpm_prefork:notice] [pid 1525] AH00169: caught SIGTERM, shutting down
[Tue Dec 06 07:55:52.592154 2016] [mpm_prefork:notice] [pid 1906] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Tue Dec 06 07:55:52.592279 2016] [core:notice] [pid 1906] AH00094: Command line: '/usr/sbin/apache2'
[Tue Dec 06 08:45:58.655029 2016] [core:error] [pid 2052] (36)File name too long: [client 66.249.79.79:42704] AH00036: access to /read-online-encyclopedia-of-christmas$
And here is an excerpt from the Apache2 access.log file:
130.193.51.38 - - [05/Dec/2016:08:21:55 +0000] "GET /file-archive-1692.xml HTTP/1.1" 404 517 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)"
66.249.79.98 - - [05/Dec/2016:08:21:55 +0000] "GET /file-archive-1575.xml HTTP/1.1" 404 516 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.htm$
172.68.11.121 - - [05/Dec/2016:08:21:56 +0000] "GET /steps-for-astaire-by-nigel-roberts.pdf HTTP/1.1" 404 537 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yand$
66.249.79.98 - - [05/Dec/2016:08:21:56 +0000] "GET /christian-prayer-liturgy-of-the-hours-black-leather.pdf HTTP/1.1" 404 550 "-" "Mozilla/5.0 (compatible; Googlebot/2$
66.249.79.122 - - [05/Dec/2016:08:21:56 +0000] "GET /colonel-roosevelt.pdf HTTP/1.1" 404 514 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.ht$
66.249.79.98 - - [05/Dec/2016:08:21:57 +0000] "GET /definitive-bob-dylan-songbook-music-sales-america.pdf HTTP/1.1" 404 548 "-" "Mozilla/5.0 (compatible; Googlebot/2.1$
172.68.11.131 - - [05/Dec/2016:08:21:57 +0000] "GET /doris-force-at-locked-gates-gytcjx.pdf HTTP/1.1" 404 537 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yand$
66.249.79.79 - - [05/Dec/2016:08:21:57 +0000] "GET /read-online-le-belv-d-re-du-diable-by-rosemary-carter.pdf HTTP/1.1" 404 548 "-" "Mozilla/5.0 (compatible; Googlebot$
66.249.79.98 - - [05/Dec/2016:08:21:58 +0000] "GET /read-online-furball-and-feathers-by-sean-sweeney.pdf HTTP/1.1" 404 547 "-" "Mozilla/5.0 (compatible; Googlebot/2.1;$
172.68.11.121 - - [05/Dec/2016:08:21:58 +0000] "GET /until-it-breaks-by-suggestivescribe.pdf HTTP/1.1" 404 538 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yan$
66.249.79.98 - - [05/Dec/2016:08:21:58 +0000] "GET /the-knights-templars-the-key-of-solomon-the-king.pdf HTTP/1.1" 404 547 "-" "Mozilla/5.0 (compatible; Googlebot/2.1;$
66.249.79.81 - - [05/Dec/2016:08:21:59 +0000] "GET /file-archive-845.xml HTTP/1.1" 404 527 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html$
66.249.79.98 - - [05/Dec/2016:08:21:59 +0000] "GET /guide-to-old-radios-pointers-pictures-and-prices.pdf HTTP/1.1" 404 547 "-" "Mozilla/5.0 (compatible; Googlebot/2.1;$
172.68.11.134 - - [05/Dec/2016:08:21:59 +0000] "GET /the-puppet-boy-of-warsaw-eva-weaver.pdf HTTP/1.1" 404 538 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yan$
66.249.79.98 - - [05/Dec/2016:08:21:59 +0000] "GET /bon-voyage-level-2-student-edition-glencoe-french.pdf HTTP/1.1" 404 548 "-" "Mozilla/5.0 (compatible; Googlebot/2.1$
66.249.79.102 - - [05/Dec/2016:08:22:00 +0000] "GET /read-online-the-seal-s-surprise-baby-by-amy-j-fetzer.pdf HTTP/1.1" 404 552 "-" "Mozilla/5.0 (compatible; Googlebot$
162.158.91.152 - - [05/Dec/2016:08:22:00 +0000] "GET /my-philosophy-for-successful-living.pdf HTTP/1.1" 404 538 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://ya$
66.249.79.106 - - [05/Dec/2016:08:22:00 +0000] "GET /read-online-time-enough-for-drums-by-ann-rinaldi.pdf HTTP/1.1" 404 548 "-" "Mozilla/5.0 (compatible; Googlebot/2.1$
I was using nano to grab these so they got partially cutoff.
As you can see my server is making all these strange GET requests, it looks like torrent traffic or something.
172.68.10.110 and 172.68.11.121 are Russian IPs.
Is this just a consequence of disabling SQL's strict mode? Any advice?
This is normal server behavior and nothing of particular concern.
The reason that you are seeing requests for some odd URLs may be that the IP address you were assigned from DigitalOcean was previously used to host another website -- its something that is very common and is nothing to worry about.

Wamp server on windows 10 Icon Red and I can't left or right click on it either

OK: Not only is my WAMP Icon Red but I can't get anything to appear if I right or left click on it. Hovering over the icon I get "None of 2 services running - server off line".
I have
Installed VC C++ Redist from 2008 - 2015.
Uninstalled Skype.
Disabled World Wide Web Publishing Services.
Made sure my Host file had "127.0.0.1 localhost" and "::1 localhost" enabled.
Installed 32bit version of WAMP.
I would given changing the listening Ports a crack but not being able to click on the WAMP icon I wasn't confident enough to change the files in the folders (Eg. Found multiple copies of httpd.conf). Would have thought steps 2 and 3 would have made this unnecessary anyway.
If in Services, I manually start wampapache and wampmysql I can access localhost/phpmyadmin and localhost/domainfolder, set up databases, install wordpress, etc. Clearly something is going wrong and I'm sure it's destined to give me furthur grief. Any Ideas? I have included my error logs and a screen shot below with my system info.
"Apache_error_log"
[Thu May 05 13:17:27.453022 2016] [auth_digest:notice] [pid 8056:tid 120] AH01757: generating secret for digest authentication ...
[Thu May 05 13:17:27.484243 2016] [mpm_winnt:notice] [pid 8056:tid 120] AH00455: Apache/2.4.17 (Win32) PHP/5.6.15 configured -- resuming normal operations
[Thu May 05 13:17:27.484243 2016] [mpm_winnt:notice] [pid 8056:tid 120] AH00456: Apache Lounge VC14 Server built: Oct 11 2015 16:06:02
[Thu May 05 13:17:27.484243 2016] [core:notice] [pid 8056:tid 120] AH00094: Command line: 'C:\wamp\bin\apache\apache2.4.17\bin\httpd.exe -d C:/wamp/bin/apache/apache2.4.17'
[Thu May 05 13:17:27.484243 2016] [mpm_winnt:notice] [pid 8056:tid 120] AH00418: Parent: Created child process 6692
[Thu May 05 13:17:27.874894 2016] [auth_digest:notice] [pid 6692:tid 428] AH01757: generating secret for digest authentication ...
[Thu May 05 13:17:27.890536 2016] [mpm_winnt:notice] [pid 6692:tid 428] AH00354: Child: Starting 64 worker threads.
[Thu May 05 14:14:30.816395 2016] [authz_core:error] [pid 6692:tid 1100] [client 192.168.0.166:2569] AH01630: client denied by server configuration: C:/wamp/www/
[Thu May 05 14:30:49.331784 2016] [mpm_winnt:notice] [pid 8056:tid 120] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Thu May 05 14:30:51.363140 2016] [mpm_winnt:notice] [pid 6692:tid 428] AH00364: Child: All worker threads have exited.
[Thu May 05 14:30:53.144329 2016] [mpm_winnt:notice] [pid 8056:tid 120] AH00430: Parent: Child process 6692 exited successfully.
[Thu May 05 15:01:43.930134 2016] [auth_digest:notice] [pid 7168:tid 592] AH01757: generating secret for digest authentication ...
[Thu May 05 15:01:44.273944 2016] [mpm_winnt:notice] [pid 7168:tid 592] AH00455: Apache/2.4.17 (Win32) PHP/5.6.15 configured -- resuming normal operations
[Thu May 05 15:01:44.273944 2016] [mpm_winnt:notice] [pid 7168:tid 592] AH00456: Apache Lounge VC14 Server built: Oct 11 2015 16:06:02
[Thu May 05 15:01:44.273944 2016] [core:notice] [pid 7168:tid 592] AH00094: Command line: 'C:\wamp\bin\apache\apache2.4.17\bin\httpd.exe -d C:/wamp/bin/apache/apache2.4.17'
[Thu May 05 15:01:44.273944 2016] [mpm_winnt:notice] [pid 7168:tid 592] AH00418: Parent: Created child process 628
[Thu May 05 15:01:44.711410 2016] [auth_digest:notice] [pid 628:tid 492] AH01757: generating secret for digest authentication ...
[Thu May 05 15:01:44.805095 2016] [mpm_winnt:notice] [pid 628:tid 492] AH00354: Child: Starting 64 worker threads.
"Last 10 lines of PHP_error_log"
[05-May-2016 05:14:53 UTC] PHP Warning: fopen(C:/wamp/bin/apache/apache2.4.17/conf/httpd.conf): failed to open stream: Permission denied in C:\wamp\scripts\wampserver.lib.php on line 307
[05-May-2016 05:14:53 UTC] PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in C:\wamp\scripts\wampserver.lib.php on line 308
[05-May-2016 05:14:53 UTC] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in C:\wamp\scripts\wampserver.lib.php on line 309
[05-May-2016 05:14:54 UTC] PHP Warning: fopen(../wampmanager.ini): failed to open stream: Permission denied in C:\wamp\scripts\refresh.php on line 1205 [05-May-2016 05:14:54 UTC] PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in C:\wamp\scripts\refresh.php on line 1206
[05-May-2016 05:14:54 UTC] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in C:\wamp\scripts\refresh.php on line 1207 [05-May-2016 05:14:54 UTC] PHP Warning: unlink(C:/wamp/bin/apache/apache2.4.17/bin/icudt54.dll): Permission denied in C:\wamp\scripts\wampserver.lib.php on line 78
[05-May-2016 05:14:54 UTC] PHP Warning: symlink(): Cannot create symlink, error code(1314) in C:\wamp\scripts\wampserver.lib.php on line 81 [05-May-2016 05:14:54 UTC] PHP Warning: unlink(C:/wamp/bin/apache/apache2.4.17/bin/icuin54.dll): Permission denied in C:\wamp\scripts\wampserver.lib.php on line 78
[05-May-2016 05:14:54 UTC] PHP Warning: symlink(): Cannot create symlink, error code(1314) in C:\wamp\scripts\wampserver.lib.php on line 81 [05-May-2016 05:14:54 UTC] PHP Warning: unlink(C:/wamp/bin/apache/apache2.4.17/bin/icuio54.dll): Permission denied in C:\wamp\scripts\wampserver.lib.php on line 78
[05-May-2016 05:14:54 UTC] PHP Warning: symlink(): Cannot create symlink, error code(1314) in C:\wamp\scripts\wampserver.lib.php on line 81 [05-May-2016 05:14:54 UTC] PHP Warning: unlink(C:/wamp/bin/apache/apache2.4.17/bin/icule54.dll): Permission denied in C:\wamp\scripts\wampserver.lib.php on line 78
System Info
Did you install WAMPServer 3 as an Administrator, using the "Run as Administrator" as instructed in the install instructions.
The installer must be run "as an administrator"
If you did not, uninstall WAMPServer and then reinstall it doing this:
Right click on the installer .exe and select "Run as Administrator"
did you have any missing DLLs while installing wampserver?
I had the same problem and the solution was
close the wampserver tray (from task manager)
go Here and download the Visual C++ Redistributable for Visual Studio and install it.
now open Wamp as administrator
the problem should be gone by now (at least that was the solution for me)

Apache dbd Internal error: AH00629: Can't connect to mysql

I'm trying to use dbd with mysql as authentification with Apache 2.4.
When Apache starts, i have this error :
[Tue May 12 13:07:18.789021 2015] [mpm_event:notice] [pid 10625:tid 140410697815936] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Tue May 12 13:07:18.789118 2015] [core:notice] [pid 10625:tid 140410697815936] AH00094: Command line: '/usr/sbin/apache2'
[Tue May 12 13:07:18.789469 2015] [dbd:error] [pid 10628:tid 140410697815936] (20014)Internal error: AH00629: Can't connect to mysql: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
[Tue May 12 13:07:18.789560 2015] [dbd:error] [pid 10628:tid 140410697815936] (20014)Internal error: AH00633: failed to initialise
[Tue May 12 13:07:18.790282 2015] [dbd:error] [pid 10629:tid 140410697815936] (20014)Internal error: AH00629: Can't connect to mysql: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
[Tue May 12 13:07:18.790441 2015] [dbd:error] [pid 10629:tid 140410697815936] (20014)Internal error: AH00633: failed to initialise
[Tue May 12 13:07:18.792481 2015] [dbd:crit] [pid 10628:tid 140410697815936] (20014)Internal error: AH00636: child init failed!
[Tue May 12 13:07:18.792595 2015] [dbd:crit] [pid 10629:tid 140410697815936] (20014)Internal error: AH00636: child init failed!
dbd_mysql.conf :
DBDriver mysql
DBDParams "host=192.168.1.2 port=3306 user=MY_USERNAME pass=MY_PASSWORD dbname=MY_DATABASE"
DBDMin 2
DBDKeep 4
DBDMax 10
DBDExptime 300
DBDPersist On
000-default.conf
[...]
DBDParams "dbname=DATABASENAME"
<IfModule authnz_ldap_module>
<Directory /var/www/test/>
AuthName "Authentication"
AuthType Basic
AuthBasicProvider dbd
AuthDBDUserPWQuery "SELECT SHA2(password, 256) AS password FROM users WHERE username = %s"
require valid-user
</Directory>
</IfModule>
[...]
If i change the password to put an invalid one, i received the exception
Internal error: AH00629: Can't connect to mysql: Access denied for user...
Debian : 7.8
Apache : 2.4.10
libapr1 : 1.5.1-3 (i tried to downgrade, but i cannot)
Note: The server do not have php nor php+mysql (libphpmysql) installed
Edit :
my.cnf (client part)
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
Edit (2) :
I also tried to use the "odbc" for mysql
odbc.ini :
dbd_mysql.conf
DBDriver odbc
DBDParams "datasource=MYSERVER_MYSQL_MYDATABASE"
DBDMin 1
DBDKeep 1
DBDMax 10
DBDExptime 300
/etc/odbc.ini (i edited the config to remove sensitive data)
[MYSERVER_MYSQL_MYDATABASE]
Driver=/usr/local/lib/libmyodbc5a.so
Description=MYSERVER_MYSQL_MYDATABASE
SERVER=192.168.1.2
PORT=
USER=MY_USER
Password=MY_PASSWORD
Database=MY_DATABASE
OPTION=3
SOCKET=
If i use :
# isql MYSERVER_MYSQL_MYDATABASE
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
It working perfectly.. but on the apache error.log :
[Thu May 14 09:07:51.323638 2015] [mpm_event:notice] [pid 1605:tid 140068309481344] AH00489: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Thu May 14 09:07:51.323725 2015] [core:notice] [pid 1605:tid 140068309481344] AH00094: Command line: '/usr/sbin/apache2'
[Thu May 14 09:07:51 2015] [dbd_odbc] Invalid DBD Parameters - open returned SQL_ERROR (-1) at /tmp/buildd/apr-util-1.5:1146
[Thu May 14 09:07:51.323827 2015] [dbd:error] [pid 1608:tid 140068309481344] (20014)Internal error: AH00629: Can't connect to odbc: [dbd_odbc] Invalid DBD Parameters - open returned SQL_ERROR (-1) at /tmp/buildd/apr-util-1.5:1146
[Thu May 14 09:07:51.323870 2015] [dbd:error] [pid 1608:tid 140068309481344] (20014)Internal error: AH00633: failed to initialise
[Thu May 14 09:07:51 2015] [dbd_odbc] Invalid DBD Parameters - open returned SQL_ERROR (-1) at /tmp/buildd/apr-util-1.5:1146
[Thu May 14 09:07:51.324332 2015] [dbd:error] [pid 1609:tid 140068309481344] (20014)Internal error: AH00629: Can't connect to odbc: [dbd_odbc] Invalid DBD Parameters - open returned SQL_ERROR (-1) at /tmp/buildd/apr-util-1.5:1146
[Thu May 14 09:07:51.324430 2015] [dbd:error] [pid 1609:tid 140068309481344] (20014)Internal error: AH00633: failed to initialise
[Thu May 14 09:07:51.331767 2015] [dbd:crit] [pid 1608:tid 140068309481344] (20014)Internal error: AH00636: child init failed!
[Thu May 14 09:07:51.331823 2015] [dbd:crit] [pid 1609:tid 140068309481344] (20014)Internal error: AH00636: child init failed!
Edit (3) :
I found that i did not register the driver :
./myodbc-installer -d -a -n "MySQL ODBC 5.3 Driver" -t "DRIVER=/usr/local/lib/libmyodbc5a.so"
Then changed the "dbd_mysql.conf" with :
DBDriver odbc
DBDParams "CONNECT='DRIVER={MySQL ODBC 5.3 Driver};SERVER=192.168.1.2;DATABASE=MY_DATABASE;UID=MY_USER;PWD=MY_PASSWORD;'"
DBDMin 1
DBDKeep 1
DBDMax 10
DBDExptime 300
But still the same problem (error.log) :
[Fri May 15 09:38:31.905733 2015] [core:notice] [pid 5215:tid 140452627486592] AH00094: Command line: '/usr/sbin/apache2'
[Fri May 15 09:38:31 2015] [dbd_odbc] Invalid DBD Parameters - open returned SQL_ERROR (-1) at /tmp/buildd/apr-util-1.5:1146
[Fri May 15 09:38:31.905842 2015] [dbd:error] [pid 5218:tid 140452627486592] (20014)Internal error: AH00629: Can't connect to odbc: [dbd_odbc] Invalid DBD Parameters - open returned SQL_ERROR (-1) at /tmp/buildd/apr-util-1.5:1146
[Fri May 15 09:38:31.905888 2015] [dbd:error] [pid 5218:tid 140452627486592] (20014)Internal error: AH00633: failed to initialise
[Fri May 15 09:38:31 2015] [dbd_odbc] Invalid DBD Parameters - open returned SQL_ERROR (-1) at /tmp/buildd/apr-util-1.5:1146
[Fri May 15 09:38:31.906424 2015] [dbd:error] [pid 5219:tid 140452627486592] (20014)Internal error: AH00629: Can't connect to odbc: [dbd_odbc] Invalid DBD Parameters - open returned SQL_ERROR (-1) at /tmp/buildd/apr-util-1.5:1146
[Fri May 15 09:38:31.906528 2015] [dbd:error] [pid 5219:tid 140452627486592] (20014)Internal error: AH00633: failed to initialise
[Fri May 15 09:38:31.915211 2015] [dbd:crit] [pid 5218:tid 140452627486592] (20014)Internal error: AH00636: child init failed!
[Fri May 15 09:38:31.915578 2015] [dbd:crit] [pid 5219:tid 140452627486592] (20014)Internal error: AH00636: child init failed!
DBDParams must be separated with comma: DBDParams param1=value1[,param2=value2]
http://httpd.apache.org/docs/2.4/mod/mod_dbd.html
in my.conf try
[client]
protocol=tcp
The reference Connecting to the MySQL Server provides an explanation of how to override the default connection methodology.
The reference Using Option Files vaguely explains what values can be placed in the my.conf file. Essentially an argument that can be passed to the mysql command on the command line (ie. --protocol) can be specified, without the dashes, in the option file.

How to debug Server Error 500 on Openshift, when rhc tail does not show errors?

I'm trying to debug a Server Error 500 with my application. I've read that you should use rhc tail to show a live log stream and with the current error, the log stream that appears when trying to display the page is:
==> app-root/logs/python.log <==
79.24.253.62 - - [01/Jan/2015:08:32:17 -0500] "GET /url/ HTTP/1.1" 500 27 "http://a-b.rhcloud.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36"
The error shown is:
Other pages work, this error only appears on certain "more advanced" pages (eg. static pages show correctly). The rest of the log, is:
==> app-root/logs/python.log <==
[Thu Jan 01 08:30:43 2015] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:openshift_t:s0:c6,c654
[Thu Jan 01 08:30:43 2015] [notice] Digest: generating secret for digest authentication ...
[Thu Jan 01 08:30:43 2015] [notice] Digest: done
[Thu Jan 01 08:30:43 2015] [notice] Apache/2.2.15 (Unix) mod_wsgi/3.4 Python/3.3.2 configured -- resuming normal operations
and:
==> app-root/logs/postgresql.log <==
2015-01-01 13:30:25 GMT LOG: shutting down
2015-01-01 13:30:25 GMT LOG: database system is shut down
2015-01-01 13:30:31 GMT LOG: could not bind socket for statistics collector: Permission denied
2015-01-01 13:30:31 GMT LOG: trying another address for the statistics collector
2015-01-01 13:30:31 GMT LOG: could not bind socket for statistics collector: Cannot assign requested address
2015-01-01 13:30:31 GMT LOG: disabling statistics collector for lack of working socket
2015-01-01 13:30:31 GMT WARNING: autovacuum not started because of misconfiguration
2015-01-01 13:30:31 GMT HINT: Enable the "track_counts" option.
2015-01-01 13:30:31 GMT LOG: database system was shut down at 2015-01-01 13:30:25 GMT
2015-01-01 13:30:31 GMT LOG: database system is ready to accept connections
What is the next step to debug this problem?
I added the following Django logging configuration which gave me the details of the 500 errors in a file django.log. I set LOG_DIR = os.environ.get('OPENSHIFT_LOG_DIR')
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'file': {
'level': 'WARNING',
'class': 'logging.FileHandler',
'filename': os.path.join(LOG_DIR, 'django.log'),
},
},
'loggers': {
'django.request': {
'handlers': ['file'],
'level': 'WARNING',
'propagate': True,
},
},
}