Making my moodle viewable throughout the intranet

Making my moodle viewable throughout the intranet

by LPS lps -
Number of replies: 5
How can I or what URL do I use to access my moodle throughout the intranet the moodle computer is connected to.  I have tried using the 127.0.0.1 address that the local host uses to connect but thats obviously not it.  I am just not sure where to go from here. I at some point want it accessable on the internet but am starting at the local intranet level.  Thanks!

-Noah-
Average of ratings: -
In reply to LPS lps

Re: Making my moodle viewable throughout the intranet

by Ralf Krause -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators

Did you install Moodle with XAMPP on your computer? Please tell us which IP address does your computer have in intranet? Which operating system is installed on your computer?

To serve your moodle in an intranet you need to modify the file ..../moodle/config.php with a text editor. $CFG->wwwroot = 'http://192.168.0.20:8081'; is the line you need to change. In my case my computer has the address 192.168.0.20 and the web server uses the port 8081 ... this is the normal port that is used by XAMPP for Mac OS X

<?php  /// Moodle Configuration File 

unset($CFG);

$CFG->dbtype    = 'mysql';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle';
$CFG->dbuser    = 'root';
$CFG->dbpass    = '';
$CFG->dbpersist =  false;
$CFG->prefix    = 'mdl_';

//$CFG->wwwroot   = 'http://127.0.0.1:8081';
$CFG->wwwroot   = 'http://192.168.0.20:8081';
$CFG->dirroot   = '/Applications/xampp/moodle';
$CFG->dataroot  = '/Applications/xampp/moodledata';
$CFG->admin     = 'admin';

$CFG->directorypermissions = 00777;  // try 02777 on a server in Safe Mode

require_once("$CFG->dirroot/lib/setup.php");
// MAKE SURE WHEN YOU EDIT THIS FILE THAT THERE ARE NO SPACES, BLANK LINES,
// RETURNS, OR ANYTHING ELSE AFTER THE TWO CHARACTERS ON THE NEXT LINE.
?>

After you saved the file you should get the Moodle from all other computers in the intranet by the defined address of your computer .... perhaps you must open the specified port in your firewall.

If you want to look to my installation guide for this
http://homepage.mac.com/ralf.krause/moodle/xampp-mac/
http://homepage.mac.com/ralf.krause/moodle/xampp-win/
... sorry, but the guide on the homepage is in german language.

I hope this helps
Ralf

In reply to Ralf Krause

Re: Making my moodle viewable throughout the intranet

by Farrukh Ikram -

Hi Guys,

i have installed Moodle 1.6 and i was also having almost the same problem, my site was working just fine on my local pc with Apache 2.2.2, PHP 5.1.4 and MySQL 5.0.2, but when i was going on the LAN and was trying to access the site from remote pcs, it was not showing any graphics and site was completely broken.

Then, i found this post and then it clicked in my mind that while installing i gave my site address as http://127.0.0.1 and 90% of the problem was then solved, after that i just went to my installation dir, opened config.php and edited the CFG->wwwroot variable to be pointing to my pc's ip. like http://10.3.6.78 and everything is fine from this point onwards ;)..

Cheers, Farrukh.

In reply to Farrukh Ikram

Re: Making my moodle viewable throughout the intranet

by iolasus raj -

greetings farrukh...

i'm facing the same prob as well.. i took ur advice.. edited and saved the file iolasus.com / httpdocs / moodle / moodle / admin/config.php

this was the intial script..

$httpsurl = str_replace('http://', 'https://', $CFG->wwwroot);
    if ($httpsurl != $CFG->wwwroot) {
        if (ini_get('allow_url_fopen')) {
            if ((($fh = @fopen($httpsurl, 'r')) == false) and ($config->loginhttps == 0)) {
                echo '<script type="text/javascript">'."\n";
                echo '<!--'."\n";
                echo "eval('document.form.loginhttps.disabled=true');\n";
                echo '-->'."\n";
                echo '</script>'."\n";

i edited the following. is it enough? coz' it didn't solve the prob! any idea why? having edited this file.. what do i do? click on the config.php file?

$httpsurl = str_replace('http://202.75.43.188', 'https://202.75.43.188', $CFG->www202.75.43.188);
    if ($httpsurl != $CFG->www202.75.43.188) {
        if (ini_get('allow_url_fopen')) {
            if ((($fh = @fopen($httpsurl, 'r')) == false) and ($config->loginhttps == 0)) {
                echo '<script type="text/javascript">'."\n";
                echo '<!--'."\n";
                echo "eval('document.form.loginhttps.disabled=true');\n";
                echo '-->'."\n";
                echo '</script>'."\n";

In reply to iolasus raj

Re: Making my moodle viewable throughout the intranet

by Matthias Dietrich -

Hi Iolasus,

I think you edit the wrong config.php. As Ralf says: you have to modify the file .../moodle/config.php with, not the file .../moodle/admin/config.php.

In .../moodle/config.php the line you need to change is:

$CFG->wwwroot='192.168.0.20';

192.168.0.20 is only an example for the IP-number of the local machine. You have to change it with your IP.

Hope this helps

Matthias

In reply to Matthias Dietrich

Re: Making my moodle viewable throughout the intranet

by Ralf Krause -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators
Hi all,

it is exactly as Matthias writes ... 192.168.0.20:8081 is an example for my own installation on my Mac in my schools network. I think you may have a different ip address and perhaps also a different port. XAMPP for Mac OS X uses the port 8081 and XAMPP for Windows uses 80.

Iolasus, you try to change the ip address at different places. You should not try to do this. The file .../moodle/config.php is the only place you should do your own settings and not anywhere else!!

In a network every computer must have its individual ip address. Mostly it's very easy to get one because there is a server who automaticly gives you an dynamic ip address if you switch your computer on in the network. The server is named dhcpd and works on the central network server or inside the internet router.

if you want to share your local installed moodle with other users in the network you need to know your exact ip address for this network. And this address now needs to be a static ip address for this moment so other users can use it to get to your moodle. But remember ... you are not allowed to use any different ip address you want to use!! This could result bad network problems.

To get your current own ip address you need to ask your own computer for this. There are different tools in the different operating systems to get the ip address. Please look at http://arktur.schule.de/wiki/index.php/Installationshandbuch:Feste_IPs ... and search for the headline "Ermittlung der MAC-Adresse" .... sorry, it's all in german language but I inserted some pictures into the text so you can see everything.

Tools to get the current ip address of your computer

Windows 98winipcfg
Windows NT/2000/XP   ipconfig /all
Mac OS Xsystem preferences > network > tcp/ip
 ifconfig
Linux ifconfig

I hope this helps ...

Ralf