Moodle after installation redirect issue

Moodle after installation redirect issue

by Mani Acos -
Number of replies: 3

Attempting to install a moodle 36_STABLE test system on my local machine, I set in my host file 127.0.0.1 to moodle.dev.local then I created an apache2 virtual host with moodle.dev.local as the ServerName and document root to /var/www/moodle


I cloned git in /var/www, creating moodle directory.

The installation went through and it gave me this config.php. I copied and pasted it into config.php and clicked next. Then I get this error

The page isn’t redirecting properly

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

    This problem can sometimes be caused by disabling or refusing to accept cookies.


Config.php:

<?php  // Moodle configuration file

unset($CFG);
global $CFG;
$CFG = new stdClass();

$CFG->dbtype    = 'mariadb';
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle';
$CFG->dbuser    = 'moodleuser';
$CFG->dbpass    = 'moodlepass';
$CFG->prefix    = 'mdl_';
$CFG->dboptions = array (

  'dbpersist' => 0,
  'dbport' => 3306,
  'dbsocket' => '',
  'dbcollation' => 'utf8mb4_general_ci',
);

$CFG->wwwroot   = 'http://moodle.dev.local';
$CFG->dataroot  = '/var/www/moodledata';
$CFG->admin     = 'admin';

$CFG->directorypermissions = 0777;

require_once(__DIR__ . '/lib/setup.php');

// There is no php closing tag in this file,
// it is intentional because it prevents trailing whitespace problems!

This makes no sense, why does it try to redirect to itself after it gave me these exact settings in the config.php?


EDIT: Curl gave me this output. It sends a 303 header with an empty location.

*   Trying 127.0.0.1...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x55bf17fdbdd0)
* Connected to moodle.dev.local (127.0.0.1) port 80 (#0)
> GET /admin/index.php HTTP/1.1
> Host: moodle.dev.local
> User-Agent: curl/7.64.0
> Accept: */*
>
< HTTP/1.1 303 See Other
< Date: Wed, 08 May 2019 08:55:14 GMT
< Server: Apache/2.4.38 (Debian)
< X-Accel-Buffering: no
< Set-Cookie: MoodleSession=41l5jnk2rcq80ff83dmu6cr0st; path=/
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate
< Pragma: no-cache
< Location:
< Content-Language: en
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=utf-8
<
<!DOCTYPE html>
<html  lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Redirect</title>
* Connection #0 to host moodle.dev.local left intact
</head><body><div style="margin-top: 3em; margin-left:auto; margin-right:auto; text-align:center;">This page should automatically redirect. If nothing is happening please use the continue link below.<br /><a href="">Continue</a></div></body></html>

Average of ratings: -
In reply to Mani Acos

Re: Moodle after installation redirect issue

by Ken Task -
Picture of Particularly helpful Moodlers
So you can access the moodle only by using a browser on the local system itself - not from any other workstation. http://moodle.dev.local

So what do you get with
netstat -ltnp | grep -w ':80'
Manually remove contents of moodledata/cache/ moodledata/localcache/ /moodledata/sessions/
Also clear browser cache/cookies for moodle.dev.local

'SoS', Ken


In reply to Ken Task

Re: Moodle after installation redirect issue

by Mani Acos -
> So you can access the moodle only by using a browser on the local system itself - not from any other workstation. http://moodle.dev.local

Yes of course only locally. This is a test installation and only my computer will resolve to the vhost ServerName due to entry in /etc/hosts

> netstat -ltnp | grep -w ':80'

Apache is running, I would not get 303 from localhost otherwise.

> Manually remove contents of moodledata/cache/ moodledata/localcache/ /moodledata/sessions/
> Also clear browser cache/cookies for moodle.dev.local

Nothing of this helped unfortunately.
In reply to Mani Acos

Re: Moodle after installation redirect issue

by Ken Task -
Picture of Particularly helpful Moodlers

Reason I asked for you to check with netstat ... did it show the IPv6 for loopback only or did it also show or the IPv4.

Does your /etc/host have an entry for both IPv4 and IPv6?

What's the DCHP lease on your network?   A year?  Every login?

If a year, I'd set the /etc/host entry for the private IP address - IPv4 - mapped to moodle.dev.local

And you could mess with network by using arp to get an IPv4 set in a more permenant fashion.

All in all, this isn't really a moodle issue, but network/server config.

'SoS', Ken