【发布时间】:2013-08-17 07:08:37
【问题描述】:
我正在尝试使用 nginx 最新版本设置 Moodle 2.3(不是 2.5)版本。之前在这个网站上有过一些建议。其中之一:Moodle 2.0 with Nginx backend。
显然,众所周知,Moodle 正在使用 path_info 规则来发布如下 URL:http://example.com/moodle/pluginfile.php/26/mod_scorm/content/1/index.html。为了摆脱所有这些噩梦,Moodle 提议在 UI 中禁用“斜线参数”。这是伟大的。但不适用于 SCORM 播放器,尽管有前一个选项,但它强制“斜线参数”。因此,在禁用“斜线参数”的情况下,一切正常。但我唯一的目标是使用 SCORM 播放器。
我尝试使用上面链接中的重写规则:
rewrite ^(.*\.php)(/)(.*)$ $1?file=/$3 last;
在 2.3-2.5 版本中不起作用。我认为它在 1.9 中有效。 现在 Moodle 正在使用不同的路径:
http://example.com/moodle/pluginfile.php/26/mod_scorm/content/1/index.html
一些nginx规则:
location ^~ /moodle {
location ~* ^.+\.(?:css|js|htc|xml|jpe?g|gif|png|ico|bmp|svg|swf|pdf|docx?|xlsx?|tiff?|txt|rtf|cgi|bat|pl|dll|aspx?|class|otf|ttf|woff|eot|less)$ {
add_header Access-Control-Allow-Origin *;
access_log off;
expires 30d;
tcp_nodelay off;
try_files $uri =404;
}
location ~* ^/moodle/.*\.php$ {
include includes/fastcgi_params.conf;
try_files $uri @dynamic;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_read_timeout 1200;
fastcgi_keep_conn on;
fastcgi_pass 127.0.0.1:9090;
}
rewrite (^.*\.php)(/.*) $1 last;
}
请告知如何解决这个问题。
【问题讨论】:
-
您应该将解决方案作为您自己问题的答案并接受它。
-
另外,能否请您发布您的整个 nginx 配置文件?那将非常有帮助。谢谢!