internal vs external server address

internal vs external server address

by John Knox -
Number of replies: 8

Ok, I'm not sure if this is a moodle question or something else.  My web server is sitting behind a NAT firewall so I have a different address internally (10.10.0.xxx) than I do externally (64.83.157.xxx).  I have been testing my web server from within my network and everything is working great.  I decided to log in from home, and when I try to log in etc. you guessed it, moodle tries to access the IP address that is an internal address. 

Assigning a public address is not an option.  Anyone else doing thins and have a work around??

 

 

Average of ratings: -
In reply to John Knox

Re: internal vs external server address

by David Durr -

John,

Good timing--I spent the weekend figuring this out.

If your network administrator will create a NAT mapping to your internal address and open port 80 on that address, you can add your moodle server to your external dns server and change the moodle config file to use servername.externaldomainname.edu. 

You will still be able to access the server internally by pointing your browser at servername.externaldomainname.edu.

Fixed my problems.

In reply to David Durr

Re: internal vs external server address

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
You can also run two Moodle installations that share the same database. smile

http://moodle.org/mod/forum/discuss.php?d=777&parent=3340
In reply to Martin Dougiamas

Re: internal vs external server address

by shane luffman -
hi, regarding internal and external access for moodle, i need to change the $_SERVER[HTTP_HOST] variable in the whole of moodle to an external ip address, is there a easy way to do this and what are the implications of doing so? thanks again shane 
In reply to shane luffman

Re: internal vs external server address

by Frederic Triquet -
Hi,

I don't know if my answer will fit your needs but we did something
that looks like what you want : our firewall allows https connections
from outside, so depending on $_SERVER['SERVER_PORT'] we
choose the right wwwroot

if ($_SERVER['SERVER_PORT'] =='80') {
  $CFG->wwwroot = 'http://192.168.1.250';
} else {
  $CFG->wwwroot = 'https://gate.blabla.fr' ;
}

You can also check SERVER_ADDR or HTTP_HOST.

HTH
Fred
In reply to Frederic Triquet

Re: internal vs external server address

by W Page -
Hi Frederic!


Thanks in advance for your reply.

WP1
In reply to W Page

Re: internal vs external server address

by Frederic Triquet -
Hi,

oh yes... excuse me for giving too few explanations shy

  • yes, the code is placed in config.php,
  • and it replaces the line with "$CFG->wwwroot = ..." (about line 66)
  • and yes again
best regards

Fred.
In reply to Frederic Triquet

Re: internal vs external server address

by W Page -
Hi Fred,

Thank you for taking the time to respond to my query.

I want to do something like this eventually, therefore, I am very interested in this topic.

WP1