Moodle 2.0 with Nginx backend

匆匆过客 提交于 2019-12-06 05:17:54

I wrote a documentation for Nginx and Moodle 2: http://docs.moodle.org/dev/Install_Moodle_On_Ubuntu_with_Nginx/PHP-fpm

Don't forget to set slash arguments to off in Moodle, otherwise you'll have problem with image links in the html editor.

First of all, you need to run php-fpm on nginx... http://www.bytetouch.com/blog/linux/how-to-nginx-with-php-fpm-fastcgi-implementation-on-debian-lenny/

to better performance i use unix sockets to connect instead tcp sockets, here appears configuration for unix sockets. http://andreas-lehr.com/blog/archives/491-nginx-wordpress-php-fpm-on-debian-squeeze.html

i use the following conf for php in nginx

            location ~ \.php($|/) {
                    if ($uri ~ "^(.+\.php)(/.*)") {
                            set $script $1;
                            set $path_info $2;
                    }

                    fastcgi_pass    unix:/var/run/php-fpm.sock;
                    fastcgi_param   SCRIPT_FILENAME  $document_root$script;
                    fastcgi_param   SCRIPT_NAME      $script;

                    include        /etc/nginx/fastcgi_params;
            }

you need to replace the unix socket, and i don't know if debian distribution have fastcgi_params include file, but have anyway by hand in tutorials

After that, you run php in a nginx server then you could use moodle and all your favorite php scripts or applications.

if you have some doubt, comment it =).

I suggest you to keep slash argument enabled, expecially if you have already uploaded resources (ie. SCORM) and put this in the server {} section of your nginx virtual host

rewrite ^(.*\.php)(/)(.*)$ $1?file=/$3 last;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!