Enabling Public Access

Enabling Public Access

by Hunter Allspaugh -
Number of replies: 9

I just installed Moodle 2.2 on an Ubuntu machine I created for the small school district I work for.  I got the installation completed without issue, but I can't seem to make it accessible to the outside world.  I went to configure the config.php file to reflect the subdomain created for the moodle specifically.  After doing so, I can no longer even access it from the localhost machine.  When I attempt, I get an error saying it can only be accessed from the subdomain address I assigned it.  After I changed it back to localhost, I still get the error message saying it can only be accessed from 'localhost', but I am using the localhost to access.  

 

Also, I need to set up an internal DNS record for internal use, but I'm not sure what I need to create for a record.

 

Please HELP!!! thanks in advance!

Average of ratings: -
In reply to Hunter Allspaugh

Re: Enabling Public Access

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi

> I just installed Moodle 2.2 on an Ubuntu machine I created for the small school district I work for. I got the installation completed without issue,

Nice. Do you mind telling the others which instructions helped you, anything from http://docs.moodle.org/22/en/Category:Installation ?

> but I can't seem to make it accessible to the outside world. I went to configure the config.php file to reflect the subdomain created for the moodle specifically.

Let's say mydomain is the main domain of your school district, like for example doldrums.gov.uk, and the "subdomain" for moodle is subdomain.mydomain, example lms.doldrums.gov.uk. How do you exactly plan to access Moodle, http://subdomain.mydomain/ or http://subdomain.mydomain/something/, example http://lms.doldrums.gov.uk/moodle?

What is the value of $CFG->wwwroot in your moodle/config.php?

> After doing so, I can no longer even access it from the localhost machine. When I attempt, I get an error saying it can only be accessed from the subdomain address I assigned it.

Have you started a browser in the server (the Ubuntu machine) and visited http://localhost/something?

> After I changed it back to localhost, I still get the error message saying it can only be accessed from 'localhost', but I am using the localhost to access.

What did you change back? Do you mean you opened config.php and changed $CFG->wwwroot to 'http://localhost/something'?

> Also, I need to set up an internal DNS record for internal use, but I'm not sure what I need to create for a record.

This is an extension of the topic above, and called "split DNS". You need to search the site for those terms. Here is the 'advanced search' http://moodle.org/mod/forum/search.php?search=&id=5.
In reply to Visvanath Ratnaweera

Re: Enabling Public Access

by Hunter Allspaugh -

Hello, and thank you for the response.

> Nice. Do you mind telling the others which instructions helped you, anything from http://docs.moodle.org/22/en/Category:Installation ?

The installation guide I followed was at http://docs.moodle.org/22/en/Installation_on_Ubuntu_using_Git.

>What is the value of $CFG->wwwroot in your moodle/config.php?

My planned moodle path is http://moodle.districtname.net/moodle.

Which moodle/config.php should I be working with?  I'm assuming the one in /var/www, but I know there is also /etc/moodle/config.php as well. 

>Have you started a browser in the server (the Ubuntu machine) and visited http://localhost/something?

Up until I tried to make it locally accessible, I was doing all of my Moodle config work on the server itself in a local browser.  It worked fine until I changed the wwwroot path from http://localhost/moodle to http://moodle.districtname.net/moodle.

> What did you change back? Do you mean you opened config.php and changed $CFG->wwwroot to 'http://localhost/something'?

Yes, it was my wwwroot value in config.php. Now that I changed it back to http://localhost/moodle I can access it within the browser on localhost but internally if I try to visit the site internally with  http://10.0.0.30/moodle or http://MoodleServer/moodle I can't access it at all.

I know my external DNS records are set up properly because originally I could arrive at moodle.districtname.net/moodle but I couldn't log in at all. I figured that was an issue with the advertised configuration of Moodle itself.

I will work on getting the DNS records straight, but any more feedback on the configuration would be fantastic.  Thanks again!

In reply to Hunter Allspaugh

Re: Enabling Public Access

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi

>> What is the value of $CFG->wwwroot in your moodle/config.php?

> My planned moodle path is http://moodle.districtname.net/moodle.

Then leave $CFG->wwwroot = 'http://moodle.districtname.net/moodle'. Moodle needs the absolute URL by design, that for a reason. Sure there are ways of making the same site work on different URLs. Since you are just starting, I advice you to stick to the design.

> Which moodle/config.php should I be working with? I'm assuming the one in /var/www, but I know there is also /etc/moodle/config.php as well.

I you've followed http://docs.moodle.org/22/en/Installation_on_Ubuntu_using_Git the Moodle source comes under /var/www/moodle. That is where the config.php is.

How come you have a /etc/moodle/config.php? Did you go "apt-get install moodle"? That would be a disaster! The Debian Moodle package is broken since a long time.
sad

>> Have you started a browser in the server (the Ubuntu machine) and visited http://localhost/something?

> Up until I tried to make it locally accessible, I was doing all of my Moodle config work on the server itself in a local browser. It worked fine until I changed the wwwroot path from http://localhost/moodle to http://moodle.districtname.net/moodle.

>> What did you change back? Do you mean you opened config.php and changed $CFG->wwwroot to 'http://localhost/something'?

> Yes, it was my wwwroot value in config.php. Now that I changed it back to http://localhost/moodle I can access it within the browser on localhost but internally if I try to visit the site internally with http://10.0.0.30/moodle or http://MoodleServer/moodle I can't access it at all.

As mentioned above, stick to http://moodle.districtname.net/moodle for the time being. If that collides with internal IP-addr/DNS visit the site from a client in the Internet. (You can still be in the Ubuntu through SSH, for eg. PuTTY.)

> I know my external DNS records are set up properly because originally I could arrive at moodle.districtname.net/moodle but I couldn't log in at all. I figured that was an issue with the advertised configuration of Moodle itself.

OK. Then visiting http://moodle.districtname.net/moodle from the Internet is the right thing.

> I will work on getting the DNS records straight, but any more feedback on the configuration would be fantastic.

Why? Above you said, your DNS is set up properly. Are you talking about split DNS? I would wait with that till everything works perfectly from the Internet.
In reply to Visvanath Ratnaweera

Re: Enabling Public Access

by Hunter Allspaugh -

So I decided to run the installation from the very beginning and start over.  I set the server to a static ip, completed the Moodle installation, and changed the wwwroot to 'http://moodle.districtname.net/moodle.  It can now be edited externally through this URL, which was ultimately my goal.  

Having both the git and apt-get of moodle must have been causing problems because this went much more smoothly than the last attempt.

I would really like to get a split DNS set up so I could allow internal traffic to access the site as well.  Is there a moodle configuration I can alter that will allow it to accept both internal and external traffic?

Thank you so much for your help so far!

In reply to Hunter Allspaugh

Re: Enabling Public Access

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Glad that you got it sorted out. For me it is yet another proof of, "You don't have to understand. Just go 'apt-get what not' and you'll be happy," is nonsense. I tried to document the middle way in this, http://docs.moodle.org/en/Installing_Moodle_on_Debian_based_distributions, may be it is never too late.
wink

No, I never had to do a split DNS for Moodle. Make use of the "'Using Moodle' advanced search" http://moodle.org/mod/forum/search.php?search=&id=5.

Good luck!
In reply to Visvanath Ratnaweera

Re: Enabling Public Access

by Hunter Allspaugh -

Thank you again!  I really appreciate it!  

I don't havea split DNS set up, but at least internally I can access it through the external fqdn now.  I couldn't before.  I have all summer to find a way to get it to recognize internal traffic by hostname so that it uses our internal infrastructure rather than our external  bandwidth.

In reply to Hunter Allspaugh

Re: Enabling Public Access

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Please see this post in the docs about how to configure your DNS to allow access via your external fqdn both internally and externally from the relevant IP address dependant upon location: Masquerading

Jon

In reply to Hunter Allspaugh

Re: Enabling Public Access

by Isaac Gómez -

In your moodle install directory, open the config file and set the line $CFG->wwwroot to:

 

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