Moodle with NGINX Layer 7 loadbalancing

Moodle with NGINX Layer 7 loadbalancing

Dinesh Kumar írta időpontban
Válaszok szám: 1

Dear All,
We already setup moodle in a separate domain "www.example.com", and we want to integrate it with other services, so we are moving to "www.example.com/moodle" by enabling NGINX layer 7 HTTP load-balancing. NGINX is the frontend to route to specific services based on the HTTP URI request, and moodle is one of it. If you know the changes needed in the source code or configuration, then pls let me know. I really appreciate your support and take the time to read it.

Thanks for your support
Dinesh


Értékelések átlaga: -
Válasz erre: Dinesh Kumar

Re: Moodle with NGINX Layer 7 loadbalancing

Matt T írta időpontban
There's really two stages of this process. First, changing the URL configuration in Moodle. Secondly, configuring the reverse proxy, and configuring Moodle to work properly with it.

1. Take a full backup of your nginx configuration file(s), code directory, database and moodledata folder. Don't proceed until this is done.
2. Configure nginx to proxy /moodle to your Moodle application server. Consult the nginx manual. In essence you will need to use the proxy_pass directive within a location block.
3. Change the wwwroot setting in config.php. $CFG->wwwroot needs to be changed from "https://www.example.com" to "https://www.example.com/moodle".
4. You should run the 'search and replace' tool to change any links on the site accordingly. See here: https://docs.moodle.org/310/en/Search_and_replace_tool
5. Check if the site works. If not, sometimes for Moodle to work properly with a reverse proxy, you need to edit config.php and set $CFG->reverseproxy = true;

If you intend to run multiple Moodle application servers and load balance them (which isn't clear based on your post), there are further advanced configuration steps. It may well be that you only intend to have one Moodle application server, and the purpose of the load balancer is to balance load between different web applications. If that's the case the above steps will suffice. If you wish to load balance Moodle, you need to run a shared database, shared cache, shared dataroot (moodledata) folder, and have a way of orchestrating code updates between the servers.
Értékelések átlaga:Useful (2)