Slash arguments doesn't work in Moodle

It has already been asked on this forum, but topic is 9 months old so I’ll create a new one. Issue is identical as original poster.

I have installed a Moodle, but I have a problem with slash arguments, since when entering url such as https://example.com/blocks/xp/index.php/config/1 indicates a 404 page error. All other Moodle pages works fine.

Below is my edited Moodle nginx template and I already tried these two configurations that doesn’t work (I’ll paste only changed elements of conf file, since everything else is exactly the same as in hestia moodle template file):

rewrite ^/(blocks/xp/..php)(/)(.)$ /$1?_r=/$3 last;

rewrite ^/(..php)(/)(.)$ /$1?file=/$3 last;

This second conf also doesn’t work:

        location ~* ^/blocks/xp/ {
                try_files $uri $uri/ /blocks/xp/index.php?$args;
        }

       location ~* ^/blocks/xp/index.php/(infos|ladder|report|config)/1$ {
               try_files $uri =404;
               fastcgi_split_path_info ^(.+\.php)(/.+)$;

               include /etc/nginx/fastcgi_params;

               fastcgi_index index.php;
               fastcgi_intercept_errors on;
               fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

               fastcgi_pass %backend_lsnr%;

               include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
       }

       location ~* ^/(.*\.php)(/)(.*)$ {
               rewrite ^/(.*\.php)(/)(.*)$ /$1?file=/$3 last;
       }

While writing this topic I found this link on moodle documentation page: Nginx - MoodleDocs and it suggests adding new block, which I did, but it still doesn’t work. Here’s my third try:

location ~ ^/blocks/xp/index.php/(infos|ladder|report|config)/1 {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_index index.php;

    include /etc/nginx/fastcgi_params;

    fastcgi_intercept_errors on;

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;

    fastcgi_pass %backend_lsnr%;

    include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
}

Any help or a hint would be highly appreciated.

Have no experience with Moodle … So I really can’t help

No worries, thanks anyway

I have several Moodle websites that are currently working fine with Hestia. About four months ago, after Moodle was finally updated to PHP 8.1, I wrote an updated tutorial on how to install Moodle using the latest version of the Hestia Control Panel. I was and still am using Debian 11 for the Hestia VPS. Here is a link to the tutorial:

https://createyourownonlinecourse.org/1-freedom-to-teach/1-2-how-to-install-moodle-on-a-hestia-vps

A couple of important points. I did not use any special Hestia Template or any special settings for Nginx. But because Moodle is very picky I did take a couple of needed steps during the Moodle Install. They are explained in the tutorial. (which is actually two articles).

I can verify that I have had no problems using Moodle blocks or anything else on Moodle ever since February 2023. However, Moodle is extremely complex so it would not take much to create some problems. I am keeping my fingers crossed that Moodle and Hestia will still work together once I update to Debian 12 and PHP 8.2.

1 Like

Also I do not use any slash arguments. But I think it is still worth trying the process I describe to see if that solved your problem.