Error 500's don't show much via web but your servers error logs will provide some clues. Could we see a clip of what some of those error log line say?
Also, to get more info from moodle (if possible), Section 7 of config-dist.php shows how to turn on debugging by adding debug lines to the config.php file.
Add those lines and let's see what moodle might saying.
Also, is this line:
$CFG->wwwroot = 'http://mysite/courses';
in your config exactly as you shared here ... or are you hiding your server's URL? Hiding ok here in forums as long as 'mysite' represents a fully qualified domain name of server that can be resolved via DNS.
It won't hurt to mention versions of Moodle involved ... found by looking at version.php file at the moodle code root.