-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
59 lines (53 loc) · 2.58 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
server {
listen 80;
server_name chamilo.helpacademy.uz;
root /home/chamilo/chamilo_app;
index index.php index.html index.htm;
client_max_body_size 1000M;
location @rewrite{
rewrite ^/courses/([^/]+)/scorm/(.*)$ /main/document/download_scorm.php?doc_url=/$2&cDir=$1 last;
rewrite ^/courses/([^/]+)/document/(.*)$ /main/document/download.php?doc_url=/$2&cDir=$1 last;
rewrite ^/courses/([^/]+)/work/(.*)$ /main/work/download.php?file=work/$2&cDir=$1 last;
rewrite ^/courses/([^/]+)/upload/(.*)$ /app/courses/$1/upload/$2 last;
try_files $uri /index.php;
break;
}
location / {
rewrite ^/courses/([^/]+)/$ /main/course_home/course_home.php?cDir=$1 last;
rewrite ^/courses/([^/]+)/index.php$ main/course_home/course_home.php?cDir=$1 last;
rewrite ^/main/admin/$ /main/admin/index.php last;
rewrite ^/main/mySpace/$ /main/mySpace/company_reports.php last;
try_files $uri @rewrite;
}
location ~ \.php$ {
client_max_body_size 20M;
try_files $uri /index.php$is_args$args;
rewrite ^/certificates/$ /certificates/index.php?id=%1 last;
rewrite ^/courses/([^/]+)/$ /main/course_home/course_home.php?cDir=$1 last;
rewrite ^/courses/([^/]+)/index.php$ /main/course_home/course_home.php?cDir=$1 last;
rewrite ^/session/([^/]+)/about/?$ /main/session/about.php?session_id=$1 last;
rewrite "^/badge/(\d{1,})/user/(\d{1,})$" /main/badge/issued.php?skill=$1&user=$2 last;
fastcgi_pass unix:/run/php/php7.4-fpm.sock; ## Adjust to match the PHP version being used (PHP 7.4)
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
location ~* \.(png|jpe?g|gif|ico)$ {
expires 1y;
access_log off;
rewrite ^/courses/([^/]+)/course-pic85x85.png$ /app/courses/$1/course-pic85x85.png last;
rewrite ^/courses/([^/]+)/course-pic.png$ /app/courses/$1/course-pic.png last;
rewrite ^/courses/([^/]+)/scorm/(.*)$ /main/document/download_scorm.php?doc_url=/$2&cDir=$1 last;
rewrite ^/courses/([^/]+)/document/(.*)$ /main/document/download.php?doc_url=/$2&cDir=$1 last;
rewrite ^/courses/([^/]+)/work/(.*)$ /main/work/download.php?file=work/$2&cDir=$1 last;
rewrite ^/courses/([^/]+)/upload/(.*)$ /app/courses/$1/upload/$2 last;
try_files $uri @rewrite;
}
location ~ ~\.(ht|git){
deny all;
}
location ^~ /tests/ {
deny all;
}
}