Incorrect access detected

Incorrect access detected

by Arif . -
Number of replies: 10

Moodle version 3.0.2-0108

Following a change in our IP address Moodle generates the following error message when attempting to view the login page (http://82.47.249.162/moodle/login/index.php):

"Incorrect access detected, this server may be accessed only through "http://82.44.186.55/moodle" address, sorry." (82.44.186.55 is our old IP address).

It seems like wwwroot in config.php needs to be updated with the new IP address.

The problem is that there doesn't seem to be a

$CFG->wwwroot
entry in the config.php file.

The only config.php file appears to be located in an 'muc' sub-folder within the main moodle folder.  Please see attached for the code that this file contains.

Any advice on how to fix this would be much appreciated.


Average of ratings: -
In reply to Arif .

Re: Incorrect access detected

by Albert Ramsbottom -

You need to change the address (URL) in the config.php in the root of moodle

It could be /moodle or /htdocs


albert

In reply to Arif .

Re: Incorrect access detected

by Albert Ramsbottom -

Yes it is /moodle

So your config.php is at http://82.47.249.162/moodle/config.php


And you need to put your new IP address where it says

$CFG->wwwroot   = 'http://yourIP';


Albert

In reply to Albert Ramsbottom

Re: Incorrect access detected

by Arif . -

This is a bit strange, as there isn't any config.php in the root of the moodle folder.  The only config.php present seems to be the one attached above which is in a 'mud' subfolder within the moodle folder.

Should a new config.php be added to the root of moodle?


In reply to Arif .

Re: Incorrect access detected

by Ken Task -
Picture of Particularly helpful Moodlers

Is there a config-dist.php file at the root of the moodle code directory?

IF so, use it as a template to make a valid config.php file.   copy config-dist.php to config.php.   Edit the config.php file filling in appropriate information ... DB type, DB host, paths, DB user, DB pass, etc. ,etc.

BTW, one only needs to point to http://IPaddress/moodle ... drop the config.php from accessing URL and also end the $CFG->wwwroot variable in the config.php file with no slash.   The config.php file is very literal and sensitive to characters (see comment at the very end of the config.php file you are editing.

'spirit of sharing', Ken


In reply to Ken Task

Re: Incorrect access detected

by Arif . -

Thanks for the advice.  Still having trouble getting this to work.  There was originally no config-dist.php in the moodle code directory - but found one on the internet and used it as a template.  An appropriately filled in config.php has now been added to the root of the moodle code directory.  But the problem as originally described is still occurring. The new config.php contains a $CFG->root variable with no slash going to the new IP address.

Is there anything further that might be tried to rectify this problem?

In reply to Arif .

Re: Incorrect access detected

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

As config-dist.php is part of the Moodle distribution I would be concerned that it was missing. If that's missing, what else is missing? Download a fresh copy of Moodle to be safe. 

In reply to Arif .

Re: Incorrect access detected

by Albert Ramsbottom -

Your config-dist.php file needs to renamed config.php and you need to put the

$CFG->wwwroot   = 'http://YournewIP/moodle';


Albert

PS you are still using your old IP address, and of course there is a config.php in the moodle root folder because if it wasn't there that message would not appear in the browser window. I do not believe you are looking in the root of your moodle installation

That message in the yellow box is proof that Moodle is looking at your config.php file

In reply to Arif .

Re: Incorrect access detected

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

You have a config.php file somewhere as that is what the browser message is referring to.  Seeing as there is no MUC folder in the moodle code folder but there is one in the moodledata, I suspect you are looking in the wrong folder.  You need to find the folder that contains your moodle code.  It should be in your main webserver folder directory.  If on linux, this is normally /var/www.  If hosted somewhere, this is normally called public_html or something similar.

In reply to Arif .

Re: Incorrect access detected

by Ken Task -
Picture of Particularly helpful Moodlers

IF I am using the correct IP address as shared by you ... the .162 is a Synology Web Station.  How do I know that?  

The reason I know that ... web page that displays right now for that
IP address says it is.

and right now it's displaying directions ...
How to publish my website ...
First line of 4 steps:
To publish your website and make it available for people on the Internet, you need to set your DiskStation to use an external IP address.

Something about EZ Internet ... etc..

So am assuming you've done that and that's why I am seeing what I am seeing .... but I should be seeing a Moodle front page - that correct?

IF so, it's an nginx web server.  

Your best resource might be: http://nginx.org/en/docs/beginners_guide.html

Check nginx config to find where 'document root' is ... that's an apache term and may not be in nginx.

Related: https://forum.nginx.org/read.php?11,231954,232017

Where ever your 'root' is ... is where the moodle code should go.

'spirit of sharing', Ken