Project

General

Profile

Bug #7926 » lms.conf

ashish kpaul, 27/12/2015 08:41

 
1
server {
2
    listen        	 80;
3
    server_name   	 lms.localhostsaa9vi.lan;
4
    access_log	  	/var/log/nginx/access_lms-localhostsaa9vi.lan.log;
5
    error_log 	        /var/log/nginx/error_lms-localhostsaa9vi.lan.log notice; 
6
    index          	index.php;
7
    root          	/var/www/saa9vi_html/lms-saa9vi-1.10.2;
8

    
9
##  Now include our shared config files
10
        charset utf-8;
11

    
12
location @rewrite{
13
    rewrite ^/courses/([^/]+)/scorm/(.*)$ /main/document/download_scorm.php?doc_url=/$2&cDir=$1 last;
14
    rewrite ^/courses/([^/]+)/document/(.*)$ /main/document/download.php?doc_url=/$2&cDir=$1 last;
15
    rewrite ^/courses/([^/]+)/work/(.*)$ /main/work/download.php?file=work/$2&cDir=$1 last;
16
    rewrite ^/courses/([^/]+)/upload/(.*)$ /app/courses/$1/upload/$2 last;
17
    try_files $uri /index.php;
18
    break;
19
  }
20

    
21
location / {
22
    rewrite ^/courses/([^/]+)/$ /main/course_home/course_home.php?cDir=$1 last;
23
    rewrite ^/courses/([^/]+)/index.php$ main/course_home/course_home.php?cDir=$1 last;
24
    rewrite ^/main/admin/$ /main/admin/index.php last;
25
    try_files $uri @rewrite;
26
  }
27

    
28
# ESSENTIAL : Configure 404 Pages
29
        error_page 404 /404.html;
30
# ESSENTIAL : Configure 50x Pages
31
        error_page 500 502 503 504 /50x.html;
32
        location = /50x.html {
33
        root /usr/share/nginx/www;
34
        }
35

    
36
  location ~ \.php$ {
37
    client_max_body_size 20M;
38
    try_files $uri /index.php$is_args$args;
39

    
40
    rewrite ^/certificates/$ /certificates/index.php?id=%1  last;
41
    rewrite ^/courses/([^/]+)/$ /main/course_home/course_home.php?cDir=$1 last;
42
    rewrite ^/courses/([^/]+)/index.php$ /main/course_home/course_home.php?cDir=$1 last;
43
    rewrite ^/session/([^/]+)/about/?$ /main/session/about.php?session_id=$1 last;
44
    rewrite "^/badge/(\d{1,})/user/(\d{1,})$" main/badge/issued.php?skill=$1&user=$2 last;
45

    
46
    fastcgi_pass	127.0.0.1:9000;
47
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
48
    include fastcgi_params;
49
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
50
    fastcgi_param HTTPS off;
51
  }
52

    
53
  # Serve static files directly
54
  location ~* \.(png|jpe?g|gif|ico)$ {
55
    expires 1y;
56
    access_log off;
57
    rewrite ^/courses/([^/]+)/course-pic85x85.png$ /app/courses/$1/course-pic85x85.png last;
58
    rewrite ^/courses/([^/]+)/course-pic.png$ /app/courses/$1/course-pic.png last;
59
    rewrite ^/courses/([^/]+)/scorm/(.*)$ /main/document/download_scorm.php?doc_url=/$2&cDir=$1 last;
60
    rewrite ^/courses/([^/]+)/document/(.*)$ /main/document/download.php?doc_url=/$2&cDir=$1 last;
61
    rewrite ^/courses/([^/]+)/work/(.*)$ /main/work/download.php?file=work/$2&cDir=$1 last;
62
    rewrite ^/courses/([^/]+)/upload/(.*)$ /app/courses/$1/upload/$2 last;
63
    try_files $uri @rewrite;
64
  }
65
  location ~ ~\.(ht|git){
66
    deny all;
67
  }
68
  location ^~ /tests/ {
69
    deny all;
70
  }
71
}
72

    
(1-1/2)