Moodle Installing and Setting up URL for public access

Moodle Installing and Setting up URL for public access

by Ratsodo Tshidzumba -
Number of replies: 4
Good day

I have installed Moodle version 4.2.1 on Windows Server 2022 virtual machine and I can only access this site using localhost in the virtual machine but I cannot access it using other computers' browser or outside the virtual machine. 

When I am trying to access it "moodle.fortcox.ac.za" I rather get the PHP version I have used when installing my Moodle site.

Please assist me where I am doing it the right way.

Regards,

Phillip 
Average of ratings: -
In reply to Ratsodo Tshidzumba

Re: Moodle Installing and Setting up URL for public access

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
You want to make Moodle running in a virtual machine accessible in the Internet. Is the host, the machine running the virtualization software, in your case the Windows 2022 server, is it accessible from the Internet? If so how exactly, through a public IP address or a domain name (or both)?
In reply to Ratsodo Tshidzumba

Re: Moodle Installing and Setting up URL for public access

by Ken Task -
Picture of Particularly helpful Moodlers
Qualifications for this response ... none!  I don't run Windows, but .. can do some leg work for ya!

First, it's highly recommended to run any web site using https ... not http (requires a certificate from a valid Certificate of Authority.

Your server:
Server: Microsoft-IIS/10.0
X-Powered-By: PHP/8.2.8
version 4.2.1

Does not have port 443 opened to the globe.

Also see chart @
http://www.syndrega.ch/blog/#php-and-dbms-compatibility-of-major-moodle-releases
Row for 4.2 says one can run moodle 4.2.3 under php 8.2
So you are two point releases behind that requirement
Footnote 7

https://docs.moodle.org/402/en/Windows_installation

When you install, use the server's fully qualified domain name ... not localhost.   If you look at the config.php file in moodle code what you have right now the wwwroot variable has http://localhost

Changing that line to the FQDN of your server, however, won't automagically open port 443 nor setup a valid cert.

'SoS', Ken

In reply to Ken Task

Re: Moodle Installing and Setting up URL for public access

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Agree with Ken. Didn't notice your domain. Your Windows 2022 server is the VM and it is reachable from the Internet through a domain name.

Side note: I am cautious in exposing the real domain name in public forums. If you want to remove yours from your OP, you may try the Report to moderator asking to mask it.

So, your solution could be as simple as replacing the current 'http://localhost' in $CFG->wwwroot to 'http://moodle.EXAMPLE.COM' and updating your code to Moodle 4.2.3 or later - assuming that you have a compatible DBMS. See https://moodledev.io/general/releases/4.2 > Database requirements.

To get that going and testing Moodle you can continue with HTTP. Tackle HTTPS (and certificates) later.
In reply to Ratsodo Tshidzumba

Re: Moodle Installing and Setting up URL for public access

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
In addition to what the others have told you, if you are getting a page saying you have set up your server successfully, then you php server is not directing that url to your moodle folder...IIS setting I would guess. Also don't use Windows. (If you are doing this on a VM, I would seriously consider setting it up on Linux environment such as Debian or Ubuntu - there is a lot more help available here for linux...
Average of ratings: Useful (1)