## Installation help

### Config uses local ip address behind NAT so I cant access from WWW

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: -
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: -
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: -
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: - Re: This is what I did. Hi Mark, I did it and it still didn't work.... Any other ideas... Jeannie Average of ratings: - Re: This is what I did. I tried and didn´t work Do you´ll know other news tips??? Regards. Average of ratings: - Re: This is what I did. You need to set up a domain name that is mapped to from outside (www) and internal network with DNS. Then in config.php change$CFG->wwwroot = 'http://192.168.1.254/moodle' to \$CFG->wwwroot='http://yourdomainname.com/moodle.

After doing this, you need to restart apache.  Then you will need to run replace.php on your database to update all the references there.

On a side note, to make this work best, you should direct apache to your moodle folder by default, then you will not need the /moodle at the end of your domain name.

Average of ratings: -
Re: This is what I did.

^^ This.

This sort of thing isn't ideal either way (use proper hosting, or find a server with a 'real' IP address) but it's preferable to use a split DNS over the config.php 'fiddle'.

Both have slight security issues unfortunately.

Average of ratings: -