Installation help

 
 
Picture of Wayne Hamilton
Config uses local ip address behind NAT so I cant access from WWW
 
When I installed/configured moodle the local ip address has been used which is behind NAT. So all works fine when I'm on my local network at home but I cant access it from the WWW.

I dont think its a problem with my NAT or DNS etc as I can access a test.php from the WWW

I noticed that in config.php I have the line
$CFG->wwwroot = 'http://192.168.1.254/moodle';

I'm guessing I need to change this to something like
$CFG->wwwroot = 'http://my.domian.com/moodle';

However just editing this on its own this doesn't fix things, I'm guessing I need to rerun some script to action it?

Any help appreciated
Wayne
 
Average of ratings: -
Picture of Mark Wong
Re: This is what I did.
 
You will have to modify it for your use..

I made it accesable iinside the FW and outside.

Comment out $CFG->wwwroot = 'http://192.168.1.254/moodle';

Add:
if($ipstr == '10.')
{
$CFG->wwwroot = 'http://10.1.1.75/moodle;
}
else
{
$CFG->wwwroot = 'http://[firewall IP address]/moodle';
}

Simple and works well!
 
Average of ratings: -
Picture of Mark Wong
Re: This is what I did.
 
BTW, 10.1.1 is my NAT network, yours is 192.168.1, but I'm sure you already know that.  Just want to be clear..
 
Average of ratings: -
Picture of Mark Wong
Re: This is what I did.
 
Ok.. let me fix this one more time. It seemed to work from 1.4, but not on 1.5, though I don't know if that really was the problem.  If you do this... it will work...

$ipstr = getenv('REMOTE_ADDR');
$ips = substr($ipstr, 0, 3);
if (ips == '10.')
{
$CFG->wwwroot = 'http://[trusted IP]/moodle';
}
else
{
$CFG->wwwroot = 'http://[firewall IP]/moodle';
}

This really works...
 
Average of ratings: -
Picture of Jean Meadows
Re: This is what I did.
 

Hi Mark,

I did it and it still didn't work....

Any other ideas...

Jeannie

 
Average of ratings: -