I have installed moodle on a server with an IP address of A.B.C.D, using the command

sudo apt-get install moodle

This site is sucessfully running on the following address


However, when I try to access moodle from another computer on the network, it so happens that all the links are absolute and not relative, i.e. all links are shown as localhost/moodle/login.php for example.

Any clues on the configuration on Ubuntu?


You didn't say how you installed moodle, this is important to know. From the looks of it, you used an Ubuntu package, when you install it asks you for the "URL for the Moodle site", which defaults to http://localhost/moodle. This maps to Moodle's $CFG->wwwroot setting, and you'd need to adjust it to have a URL with your server's actual IP address or, better yet, fully-qualified domain name.

There are two main ways to do this:

  1. sudo dpkg-reconfigure moodle will run Moodle's basic setup process again and ask you for the URL. Remember to say "NO" when it asks you to reconfigure the database, otherwise it will destroy any changes you made.

  2. Manually edit /etc/moodle/config.php and change $CFG->wwwroot. The file is owned by the root user so you need to use sudo to invoke your preferred text editor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.