Jump to content

Recommended Posts

Posted

I am using Moodle locally hosted on Intranet

Students can access it without any problem. Its a normal server with one NIC.

 

We have a setup of Local Active Directory, DNS & DHCP etc.

 

Currently the setup is that the IP address of the Moodle is mapped with ISP and LAN users are accessing it via that external IP address.

 

It means that even local users on LAN use the External IP address to access it, which is a bit slow.

 

I read a lot on forums and everyone is suggesting to forward local machines via DNS to point at the external address.

 

How can i do it?

I want to have the settings of external IP address in Moodle Config file meanwhile i want the intranet users to access the server on LAN with excellent speed.

 

Can anyone tell me in steps how to do it via DNS?

 

thanks

Posted

Hi,

 

Welcome to Edugeek.

 

The domain you access Moodle on:

 

1) Is it the same address internally & externally?

2) Do you have a 'zone' for this domain on your internal DNS so that internal queries use internal hostnames for email servers etc?

 

Does your moodle server have an internal IP that your ISP nat an external one to or does it bind directly to an external IP?

 

Your answers to the above will help identify the best way to do it.

Posted (edited)

thanks for ur reply kmount & FN-GM

1) Is it the same address internally & externally?

No the actual IP address of server on Lan is 10.14.*.* but i access it via external ip 212.*.*.* even on Lan i use this IP

 

2) Do you have a 'zone' for this domain on your internal DNS so that internal queries use internal hostnames for email servers etc?

We do have a DNS but i didnt define anything on it as yet

 

Does your moodle server have an internal IP that your ISP nat an external one to or does it bind directly to an external IP?

I have internal IP and my ISP NAT or connects it via IR

 

ON my DNS i have following things

Forward Lookup Zones

Reverse Lookup Zones

Edited by karan_jhr
Posted

What is inside Forward Lookup Zones?

 

Assuming your Moodle is accessed at vle.domain.com from both inside/outside do you have domain.com in your forward lookup zones?

Posted

You have an internal server called myserver.mydomain.internal but you reach it from the Internet using a public IP or FQDN eg. moodle.myschool.com

Using a single NIC you must be using a NAT router and port redirection/forwarding.

 

This situation is called "Split DNS"

 

Google for this and follow the hundreds of guides on how to set this up...

Posted
I presume as well as your internal DNS server you have external DNS provided by some external DNS provider. If thats the case you just create a record on your internal DNS server pointing to your internal IP 10.14.*.* and on your external dns provider you leave it as the external IP 212.*.*.*
Posted

okay it worked

thanks

Now i am able to access it locally via 10.14.*.*

External Address is 212.*.*

In Config.php i have defined local IP 10.14.*.* and its working perfectly fine

BUT

When i am browsing via Internet

It loads the page BUT without CSS???

Posted
okay it worked

thanks

Now i am able to access it locally via 10.14.*.*

External Address is 212.*.*

In Config.php i have defined local IP 10.14.*.* and its working perfectly fine

BUT

When i am browsing via Internet

It loads the page BUT without CSS???

 

Check the address that is referenced for the CSS - is it using absolute addressing e.g. moodle.domain.sch.uk/styles.css or is it relative e.g. just /theme/styles.css?

 

Just View Source and do a find for .css and you should get your answer.

Posted

I cannot see any CSS settings in my config file

please help me in changing it

 

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://10.14.*.*/moodle';
$CFG->dirroot   = 'C:/Inetpub/wwwroot/moodle';
$CFG->dataroot  = 'C:/Inetpub/moodledata';
$CFG->admin     = 'admin';

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

$CFG->passwordsaltmain = '>+@ #0CMXq?>_Pz@e^+].H],';

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.
?>

Posted

karan_jhr: Don't configure the Moodle setting (wwwroot) to the IP address - this will only work for internet or internal - not both. But do configure it for the hostname (e.g. http://www.myschool.com/moodle).

 

If you've followed the instructions and advice above, everything should then work.

 

On your LAN, your DNS server should be configured for www.myschool.com to resolve to 10.14.*.*. So when your LAN clients try to access Moodle, your internal DNS server will respond with 10.14.*.* and it will be fine. On the Internet, people will receive 212.*.*.* as the address, and it will be fine.

Posted
I cannot see any CSS settings in my config file

please help me in changing it

 

Nothing that in-depth - just load your VLE in IE, Firefox etc., go to the View menu and choose to View Source. This will show you HTML code that constitutes the web page - and in there you should see where the page is trying to get the CSS from. If you've changed the wwwroot in your config as above it will probably be looking at 10.14.*.*/moodle/themes/styles.css (or similar), which obviously then won't work for people accessing externally. Change the wwwroot to your domain, as webman says, and then everyone should be able to get to it.

 

In short: do what webman said and it should fix the CSS error.

Posted (edited)
Did exactly as webman said

Local address 10.14.*.* on LAN and Config File

Working good

Via Internet Loads but without CSS :(

 

Looked at the site at the address you messaged - I can load it but no CSS - it looks like it is trying to load the stylesheets from http://apps.{URL}.sa (http://apps.{URL}.sa/moodle/theme/standard/styles.php to be exact).

 

In the config file, don't use an IP. Use the actual web address that then resolves to the IP.

Edited by sonofsanta
URL redacted by request
Posted

I am not using an ip in the config file anymore

its actual host name

is there anyway to bind he CSS to a specific address to load?

Through actual name it loads very well on LAN but not on Internet??

Posted (edited)

karan_jhr: The best and preferred way of doing things is via the hostname. Are all your users really accessing it externally just via the IP address?

 

Through actual name it loads very well on LAN but not on Internet??

 

This is because there is no DNS entry for apps.{URL} pointing to the 212.*.*.* address on the internet DNS system.

 

If you can't get that working, you can change it like this:

 

$CFG->wwwroot = 'http://' . $_SERVER["HTTP_HOST"] . '/moodle';

Edited by robk
redacted live url at request of owner
  • Thanks 3
Posted (edited)

my latest config file is

 

<?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://212.xx.x.xx/moodle';

$CFG->wwwroot = 'http://apps.{URL}/moodle';

$CFG->dirroot = 'C:/Inetpub/wwwroot/moodle';

$CFG->dataroot = 'C:/Inetpub/moodledata';

$CFG->admin = 'admin';

 

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

 

$CFG->passwordsaltmain = '>+@ #0CMXq?>_Pz@e^+].H],';

 

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.

?>[\code]

Edited by robk
redacted live url at request of owner
Posted

As webman says - the URl you are using for your CSS files doesn't resolve on the internet, there is no public DNS entry for the domain you're using.

 

Not entirely sure where you edit the CSS settings themselves though - I must confess that I went for a managed solution to our Moodle because otherwise I would have ended up spending all my time running the site instead of all my other duties, so I don't have the specific Moodle knowledge to be able to guide you to the relevant setting.

 

If anyone else does know - there must be some way of uploading the stylesheet onto the VLE server and then using a relative URL to it. Perhaps the absolute address just needs tweaking so that it points to the VLE URL.

 

So I know what your error is, just not where to fix it - someone else will have to take over from me here I'm afraid.

Posted

What address do people use to get to the moodle from outside? Do they just have to type in the IP address or do you have an actual URL?

 

The address you use in the wwwroot isn't on the internet DNS servers. You might have to ask your ISP to create the DNS A record for that address?

  • Thanks 1
Posted
i really appreciate your help sonofsanta

thanks for your time and interest

Really appreciated

 

That's alright - we're all in it together, right?

 

Any time you want to show someone some appreciation just click the > Thank Post < link at the bottom of their post, so we can all tell who's useful round here!

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...