Change the domain name of the MoodleBox

Warning

The operations described on this page may render your MoodleBox unusable, requiring the complete wiping of the SD card and the loss of all data (course contents, installed plug-ins, custom configurations, etc.). Do this only if you know exactly what you are doing. In any case, no support is provided on this subject.

We accept no responsibility for any direct or indirect damage caused by the use of the MoodleBox, in particular following a change of domain name.

How to proceed

The instructions below shows how to change the domain name of a MoodleBox, which will allow a local device to reach it with a new URL. The example shows how to give the MoodleBox the domain name learn.example.com.

Info

This operation has no influence on access to the MoodleBox from an Ethernet network or from the Internet: the MoodleBox will remain accessible only from the Wi-Fi network it provides, from the devices that have connected to it.

Step 1: Change the host name (hostname)

In the last line of the /etc/hosts file, replace moodlebox with learn.example.com.

In the /etc/hostname file, replace moodlebox with learn.example.com (this modification is not necessary, but highly recommended).

Step 2: Adapt the configuration of the nginx web server

In the file /etc/nginx/sites-available/default, replace moodlebox with the full domain name (FQDN) learn.example.com in the server_name directive.

Step 3: Adapt the DNS server masquerading configuration

In the file /etc/NetworkManager/dnsmasq-shared.d/00-dhcp.conf, replace home by learn.example.com in the two lines that start with domain and local.

If your domain name is a public one, comment out or delete completely the line starting with address. Otherwise, if your new domain name will remain local, ending with .home, you can keep this line untouched.

Step 4: Adapt the captive portal configuration (Nodogsplash)

In the file /etc/nodogsplash/nodogsplash.conf, replace the URL http://moodlebox.home/ by http://learn.example.com.

Step 5: Adapt the Moodle configuration (Moodle URL)

In the file /var/www/moodle/config.php, on the line beginning with $CFG->wwwroot, replace the URL http://moodlebox.home by http://learn.example.com. Do not add a slash at the end of the URL.

Step 6: Restart the MoodleBox

In order to apply these changes, restart your MoodleBox.

Step 7: Replace Moodle URLs

Access your MoodleBox through your browser using the new address http://learn.example.com/ and use the URL replacement tool at http://learn.example.com/admin/tool/replace/index.php to replace URLs in the Moodle database.

Step 8: Replace SSL certificates (optional)

If you want to use HTTPS, you’ll have to get your own SSL certificates, as those provided by the MoodleBox won’t work with your custom domain name learn.example.com. Don’t forget to change the URL too.