has many :code_blocks

Random thoughts and postings to keep track of my learning process

Nginx Location block for moodle

leave a comment »


This is an example nginx location block for moodle if you want to access you moodle installation at a suburl; ie, http://yoursite/moodle. This example assumes that your moodle installation exists at /usr/share/moodle

location /moodle {
root /usr/share/;
index index.php index.html index.htm;
# moodle rewrite rules
#rewrite ^/(.*.php)(/)(.*)$ /$1?file=/$3 last;

location ~ ^/moodle/(.+\.php)$ {
root /usr/share/;
index index.php index.html index.htm;
rewrite ^/(.*.php)(/)(.*)$ /$1?file=/$3 last;
try_files $uri $uri/index.php;
#try_files $uri =404;
#root /usr/share/;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
#fastcgi_index demo1.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}

#location ~* ^/moodle/(.+\.(jpg|jpeg|theme|gif|css|png|js|ico|html|xml|txt))$ {
#  root /usr/share/;
#}
} #location /moodle

 

references: http://www.scalescale.com/tips/nginx/nginx-moodle/

 

Advertisements

Written by nkartcode

05/07/2016 at 9:11 AM

Posted in moodle, nginx

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: