Help renaming/moving moodle server (Incorrect access detected)

Help renaming/moving moodle server (Incorrect access detected)

by Jake Hammerschmitt -
Number of replies: 10

Hello,

I'm having troubles getting my moodle site up and running after moving it and renaming the server it is on. (Moodle 2.8.3 on Ubuntu 14.04) I've scoured these forums and tried everything I could find, but I cannot get the 'Incorrect access detected...' message to go away. Worse yet, when it re-directs, I get a 404 page not found error.

I had the server/site up and running from my home office with no issues (I accessed it via my IP address on port 8080). When I moved it to it's permanent home, it had to be re-named and configured to listen on port 80. Prior to doing so, I backed up the entire filing system and dumped the database.  

My moodle folder was in /var/www/html. So, that's where I went to modify my config.php file. I updated the wwwroot variable so it now has the FQDN/html/moodle. It used to be IP_ADDRESS:8080/html/moodle (sorry, I don't have the exact address).

Next I followed the instructions here to update the mysql dump file:  https://docs.moodle.org/21/en/Moodle_migration and followed method B.

   (b) The second method is to backup the Moodle database first, then use the search and replace feature of your text editor (or use a unix tool like       sed) to replace the old URL with the new one in the mysql backup file. Here is an example sed command:

     #sed -e 's/oldserver.com/newserver.com/g' oldmysqldump.sql > newmysqldump.sql.  

I then dropped the moodle database, created a new one, and imported the dump file.

Now I'm still getting the incorrect access message and cannot seem to get around it...Any suggestions???  Thanks in advance!

Average of ratings: -
In reply to Jake Hammerschmitt

Re: Help renaming/moving moodle server (Incorrect access detected)

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
You said:
> I updated the wwwroot variable so it now has the FQDN/html/moodle

Looks suspicious to me. Create (or copy) a simple HTML file, say test.html, to your html/moodle/ and see whether you can reach it from a remote browser at http://FQDN/html/moodle/test.html. If not try, without /html/ and/or without /moodle/. It is possible that the DocumentRoot in Apache is different (from your home server).
Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: Help renaming/moving moodle server (Incorrect access detected)

by Jake Hammerschmitt -

Ok, I created test.html and I can see it via a remote browser when it is in /var/www/html by pointing the browser to FQDN/test.html.

My apache document root is set to /var/www.

So, should I'm thinking my moodle folder should be in /var/www/html and my wwwroot variable should be FQDN/moodle, no?

If that is true, what should I update the URL to in all the database columns?


Thanks again!!!

In reply to Jake Hammerschmitt

Re: Help renaming/moving moodle server (Incorrect access detected)

by Jake Hammerschmitt -

Also, I dropped a copy of test.html into the /var/www/html/moodle folder.  That is now visible via FQDN/moodle/test.html.

In reply to Jake Hammerschmitt

Re: Help renaming/moving moodle server (Incorrect access detected)

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

So now if you switch your apache document root to /var/www/moodle then you should not need the moodle part in the url.

I would double check that with your test file.  Then, make sure that you config.php file in moodle reflects the FQDN and the correct location of your moodledata folder.

Check that you can get to the home page of moodle.  Then when that is loading correctly, update the url's in your database.

In reply to Jake Hammerschmitt

Re: Help renaming/moving moodle server (Incorrect access detected)

by Bret Miller -
Picture of Particularly helpful Moodlers

Right, so FQDN/moodle is what $CFG->wwwroot should point to.

In reply to Bret Miller

Re: Help renaming/moving moodle server (Incorrect access detected)

by Jake Hammerschmitt -

Ok, I'll give that a try tomorrow.  


One more thing I'm curious about, when I handed the server over to it's rightful owner, they changed the name.  The URL in the 'Incorrect access...' Message has a mixed case host name (SERVERname.Domain.com).  I'm assuming this is what the value of /etc/hostname and /etc/hosts is.  I made it all lowercase in the config.php file as well as in all the database entries.  Would this cause the behavior I'm seeing?

In reply to Jake Hammerschmitt

Re: Help renaming/moving moodle server (Incorrect access detected)

by Bret Miller -
Picture of Particularly helpful Moodlers

The host name should be case insensitive while the remainder of the URI is case sensitive on Linux.

In reply to Visvanath Ratnaweera

Re: Help renaming/moving moodle server (Incorrect access detected)

by Jake Hammerschmitt -

Still no joy...

I know that the hostname should be case insensitive and that's proven by the fact that I can access the test.html page. I checked my /etc/hostname and /etc/hosts files and both are all uppercase, however the message that comes up on the 'Incorrect Access...' page has a mixed case FQDN.  I have to check with the network guys, this may be the way that it was entered into DNS.  When I reach the error page, it redirects back to the same page and loops over and over.

Does moodle do some sort of case sensitive comparison?

In reply to Jake Hammerschmitt

Re: Help renaming/moving moodle server (Incorrect access detected)

by Jake Hammerschmitt -

Networking had the mixed case entry in the web proxy.  That was corrected.  I'm not sure if this could possibly be the problem, any thoughts?

I have to make another trip over to the site to flush the DNS cache, hopefully it works!

In reply to Jake Hammerschmitt

Re: Help renaming/moving moodle server (Incorrect access detected)

by Jake Hammerschmitt -

That was the problem.  After changing the entry to all lower case and flushing the DNS cache on the server, everything started working.


Thanks to everyone for your suggestions!