3.1.6.: Calling my moodlesite via IP-address doesn't work :Fatal error: $CFG->dataroot ..

3.1.6.: Calling my moodlesite via IP-address doesn't work :Fatal error: $CFG->dataroot ..

by Monica Franz -
Number of replies: 4

Hi,

for maintenance purpose I (admin) want to redirect https:/mymoodlesite.mydomain to an own 403-error document. The htaccess file in the moodle directory looks like this:

ErrorDocument 403 http://myerrordocument.mydomain
Order deny,allow
Deny from all
Allow from mymoodleipaddress

Using the URL https://mymoodlesite.mydomain the error-document is opening, but when I use the IP address mymoodleipaddress I get

Fatal error: $CFG->dataroot is not configured properly, directory does not exist or is not accessible! Exiting.

instead of the website, eventhough the permissions for moodledata are 2777.

What do I have to change to be able to do the maintenance work on mymoodlesite not letting others to have access to it during that time?

Setting to maintenance mode via cli, doesn't allow the admin to work on the moodlesite, that is why I want to use the redirection.

Thanks in advance for answering.

Cheers,

Monica

Average of ratings: -
In reply to Monica Franz

Re: 3.1.6.: Calling my moodlesite via IP-address doesn't work :Fatal error: $CFG->dataroot ..

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The dataroot setting is nothing to do with your redirect. Or it's highly unlikely. 

Usually that error is true.  I'm not sure why you are trying to set the sticky bit. I would chmod to 0777 - don't forget to set the permission for all the subdirectories recursively. 

In reply to Howard Miller

Re: 3.1.6.: Calling my moodlesite via IP-address doesn't work :Fatal error: $CFG->dataroot ..

by Monica Franz -
The permissions are set to default mode, which seems to be correct.

The problem seems to be the Rewritecond in the htaccess-file to set https for the Ip-address. It always changes to the http protocol, and that doesn't match the moodle config.

But using the https-protokoll with the Ip-address, opens my error document, but I want my moodle website to be opend using the Ip-address, so I can continue maintenance work with out other users 'messing' around.


In reply to Monica Franz

Re: 3.1.6.: Calling my moodlesite via IP-address doesn't work :Fatal error: $CFG->dataroot ..

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I've thought about it but I can see no scenario where a rewrite condition would result in that 'cannot access moodledata' error being displayed. 

Moodle is getting executed in order for the error to be displayed. I tend to take these things on face value. If moodle says it cannot access that file area then it probably can't. Apache settings would be the last place I would look.

Other than that I have no idea... anybody else?

In reply to Howard Miller

Re: 3.1.6.: Calling my moodlesite via IP-address doesn't work :Fatal error: $CFG->dataroot ..

by Monica Franz -
I tried to fix this problem with Apache, but get the same fatal error as with htaccess!

The part of Apache SSL conf for the Documentroot call looks like this

<VirtualHost _default_:80>
 ServerName myservername
 Redirect / https://mymoodlewebsite.mydomain/

</VirtualHost>

NameVirtualHost *:443
...

<IfModule mod_ssl.c>
<VirtualHost *:443>
  ...
   
      ServerName myservername

RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^myipaddress
RewriteRule /index.php http://myerrordocument.mydomain
RewriteRule ^myipaddress  https:\/\/myipaddress

DocumentRoot /mymoodledirectory

....

I have no idea what I could do. I tried other conditions (HTTPS, REMOTE_ADDR,HTTP_HOST) as well, with the same result.

How do others use a maintenance page, so the admin can still do her maintenace work on the moodle site  at the same time?

Cheers,
Monica