Moodle 4.0 problems with Nginx in RockyLinux 9 (PHP 8 + PostgreSQL)

Moodle 4.0 problems with Nginx in RockyLinux 9 (PHP 8 + PostgreSQL)

Pedro Crispim發表於
Number of replies: 7

Hello.

I'm a computer science teacher in a public secondary school, in Portugal. I'm installing a completely new system for Moodle 4.0 (although the server itself is not new). We had, previously, Moodle 3 with Apache and MySQL, but after reading a lot in Moodle.org, I decided to go with Nginx and PostgreSQL.

After a lot of research (lots of problems getting everything to work, with secusity in mind), I got Moodle 4.0 to work with Nginx 1.22.0 + PostgreSQL 14.5 + PHP 8.0.13 in RockyLinux 9.0 (with SELinux in Enforce mode).

The problem, however, is that I cannot get file uploads to work, neither drag files to upload areas (even if I use setenforce = 0).

If I try to upload from "Choose a file...", it allows me to choose the file, but when I click "Upload this file", it stays eternally uploading:


If I try to drag the file, I get a "Error connecting to the server":

Other important info:

The file isn't bigger then the file limits (file size is 5 MB):


The active theme is Boost:


I had debugging active (in DEVELOPER mode), but got no error/info messages.


The only php_extension in admin/environment.php that shows "Check" is XMLRPC, but that's not a problem, since I use PHP 8.0:

Is there anyone used to work with Nginx that can give me some help?

I woul aprecciate it a lot!

評比平均分數: -
In reply to Pedro Crispim

Re: Moodle 4.0 problems with Nginx in RockyLinux 9 (PHP 8 + PostgreSQL)

Visvanath Ratnaweera發表於
Particularly helpful Moodlers的相片 Translators的相片
In that screen-shot you are uploading a zip file of a plug-in in to the Plugin installer. Can you upload files to ordinary File resources https://docs.moodle.org/400/en/File_resource ?
In reply to Visvanath Ratnaweera

Re: Moodle 4.0 problems with Nginx in RockyLinux 9 (PHP 8 + PostgreSQL)

Pedro Crispim發表於
In a normal File resource, it works (either by dragging, either by File picker).
In reply to Pedro Crispim

Re: Moodle 4.0 problems with Nginx in RockyLinux 9 (PHP 8 + PostgreSQL)

Visvanath Ratnaweera發表於
Particularly helpful Moodlers的相片 Translators的相片
I never install additional plug-ins in the Moodle GUI other in "sandboxes". So don't know the details. I suspect:
a) either Moodle is trying to save the zip file in a temporary directory and doesn't have the permissions to do it.
b) the plug-ins ultimately go to places like mod/, theme/, etc. and Moodle doesn't have the required (write) permissions.

I find it ironical, after maximizing security of your Moodle instance, you go the GUI install path for additional plug-ins, where you have to give the web server write permissions in various places in the web source directory - and the things it places there are owned by the web server.

In reply to Visvanath Ratnaweera

Re: Moodle 4.0 problems with Nginx in RockyLinux 9 (PHP 8 + PostgreSQL)

Pedro Crispim發表於
Thank you very much, Visvanath Ratnaweera!
I'm going to install the modules using Git.
In reply to Pedro Crispim

Re: Moodle 4.0 problems with Nginx in RockyLinux 9 (PHP 8 + PostgreSQL)

Visvanath Ratnaweera發表於
Particularly helpful Moodlers的相片 Translators的相片
Hi

Talking of Git, if you have installed your Moodle by unpacking the zip archive, I recommend switching to Git. See https://docs.moodle.org/en/Git_for_Administrators#Obtaining_the_code_from_Git. I you replace the current (unzipped) code tree with a fresh downloaded Git repo marched to the latest of your version of Moodle (3.9, 3.11, 4.0) it will recognize a minor upgrade. If it successfully ends this upgrade procedure, you've switched to Git.

I'm curious to know whether the original problem was a) or b) or something else. Get a debug trace by raising the https://docs.moodle.org/en/Debugging level to DEVELOPER. It will have the evidence.
In reply to Visvanath Ratnaweera

Re: Moodle 4.0 problems with Nginx in RockyLinux 9 (PHP 8 + PostgreSQL)

Pedro Crispim發表於
I did installed Moodle using GIT (as I do with every plugin). The reason I was using ZIP is that if I tried to install Office 365 Plugin for Moodle, using git, it includes all the plugins, and I didn't want them all at once.

But I did get working by giving extra write permissions in Moodle directory (instead of 755, I gave it 775), so it was problem a).
In reply to Pedro Crispim

Re: Moodle 4.0 problems with Nginx in RockyLinux 9 (PHP 8 + PostgreSQL)

Visvanath Ratnaweera發表於
Particularly helpful Moodlers的相片 Translators的相片
Hi

Thanks for confirming. It was a) Moodle is trying to save the zip file in a temporary directory and doesn't have the permissions to do it. Looking back, it must be.

You made the GUI installation possible by opening file permissions. I hope, once it is through you closed those permissions.

Yes, it is a possible path: Relax file permissions when you install plug-ins on the GUI and later tighten them. I don't do it. The manual interaction is too error prone. I've documented my scheme here https://moodle.org/mod/forum/discuss.php?d=438257#p1764359.