Tuesday 17 June 2014

Nginx configuration for Moodle

If the moodle directory is /moodle then put this in the configuration file nginx.conf or the appropriate file under the nginx.include.d folder:

server {
     server_name  example.com www.example.com;
     rewrite ^/moodle/(.*\.php)(/)(.*)$ /moodle/$1?file=/$3 last;
 
In the same file, in the php section:
 
  location ~ \.php$ {
     fastcgi_split_path_info ^(.+\.php)(/.+)$;
 
 
Putting the same rewrite rule in the location /moodle section does not work.
 
If you are using the cpXstack plugin for cPanel, make sure you follow this:
 
For any domain that has nginX+PHP-FPM enabled, additional nginX configuration can be added by the root user at
/opt/pifpm/nginx.include.d/<DOMAINNAME>.autoinclude where DOMAINNAME is the domain .
 
Changes made any where else may not be preserved during server shut down. 

No comments:

Post a Comment