Moodle 2.3 with Nginx vs slash argument rewrite Moodle 2.3 with Nginx vs slash argument rewrite nginx nginx

Moodle 2.3 with Nginx vs slash argument rewrite


(Answered by the OP in a question edit. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )

The OP wrote:

I solved this by putting rewrite directive in {server} not in {location} section. In my scenario moodle is installed under subfolder: example.com/moodle.

server {     server_name  example.com www.example.com;     rewrite ^/moodle/(.*\.php)(/)(.*)$ /moodle/$1?file=/$3 last;  location ^~ /moodle {     try_files $uri $uri/ /index.php?q=$request_uri;     index index.php index.html index.htm;  location ~ \.php$ {     fastcgi_split_path_info ^(.+\.php)(/.+)$;     fastcgi_pass 127.0.0.1:9090;        include      includes/fastcgi_params.conf;        }        }        }