This repository has been archived by the owner on Jul 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx-conf-file.conf
111 lines (92 loc) · 5.21 KB
/
nginx-conf-file.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
server {
listen 80;
server_name {your_domain_url};
access_log {give_your_access_log_path_here} main;
error_log {give_your_error_log_path_here}
root {replace_root_path_here};
gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
# gzip_comp_level 9;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
# gzip_http_version 1.1;
gzip_types text/plain application/xml text/css text/js text/xml application/x-javascript application/javascript text/javascript application/json application/xml+rss;
if ($args ~ "_escaped_fragment_") {
rewrite ^ /server/php/plugins/SEO/seo.php?path=$1 last;
}
#rewrite ^/assets/(.*)$ /src/app/themes/tmooh/assets/$1 last;
rewrite ^/api/(.*)$ /server/php/Slim/public/index.php;
rewrite ^/sitemap(.*)$ /server/php/Slim/public/index.php;
rewrite ^/api_explorer/api/ /server/php/Slim/public/index.php;
rewrite ^/d/video/([a-zA-Z_]*)/([0-9]*)/([a-zA-Z0-9_\.]*)/([0-9]*)/([a-zA-Z0-9_\.]*)$ /server/php/plugins/VideoLessons/play_video.php?type=$1&id=$2&hash=$3×tamp=$4&q=$5 last;
rewrite ^/d/video/([a-zA-Z_]*)/([0-9]*)/([a-zA-Z0-9_\.]*)/([0-9]*)$ /server/php/plugins/VideoLessons/play_video.php?type=$1&id=$2&hash=$3×tamp=$4 last;
rewrite ^/d/client/download/([0-9]*)/([a-zA-Z0-9_\.]*)/([0-9]*)$ /server/php/plugins/DownloadableFileLessons/download.php?id=$1&hash=$2×tamp=$3 last;
rewrite ^/d/certificate/([0-9]*)/([a-zA-Z0-9_\.]*)/([a-zA-Z]*)$ /server/php/certificate.php?course_user_id=$1&hash=$2&type=$3 last;
rewrite ^/TC-([a-zA-Z0-9_\.]*)$ /server/php/certificate_view.php?course_user_id=$1 last;
rewrite ^/d/ipn/receiver_account_ipn/([0-9]*)/users/([0-9]*)/hash/([a-zA-Z0-9_\.]*)$ /server/php/plugins/Payout/receiver_account_ipn.php?gateway_id=$1&user_id=$2&hash=$3 last;
rewrite ^/d/ipn/process_ipn/([0-9]*)/hash/([a-zA-Z0-9_\.]*)$ /server/php/plugins/SudoPay/process_ipn.php?course_user_id=$1&hash=$2 last;
rewrite ^/d/ipn/paypal_process_ipn/([0-9]*)/hash/([a-zA-Z0-9_\.]*)$ /server/php/plugins/PayPal/paypal_payment_process_ipn.php?course_user_id=$1&hash=$2 last;
rewrite ^/d/ipn/process_ipn/user_subscription_logs/([0-9]*)/hash/([a-zA-Z0-9_\.]*)$ /server/php/plugins/SudoPay/process_ipn.php?user_subscription_logs_id=$1&hash=$2 last;
rewrite ^/d/ipn/paypal_process_ipn/user_subscriptions/([0-9]*)/hash/([a-zA-Z0-9_\.]*)$ /server/php/plugins/PayPal/paypal_subscription_process_ipn.php?user_subscription_id=$1&hash=$2 last;
location / {
if ($http_user_agent ~* "WhatsApp|Screaming Frog SEO Spider/9.4|rogerbot|teoma|outbrain|W3C_Validator|vkShare|slackbot|pinterest|embedly|showyoubot|linkedinbot|quora link preview|googlebot|yahoo|bingbot|baiduspider|Slurp|DuckDuckBot|yandex|yeti|yodaobot|gigabot|AOLBuild|ia_archiver|Exabot|YandexBot|facebookexternalhit|facebot|twitterbot|developers\.google\.com|Twitterbot") {
rewrite ^ /server/php/plugins/SEO/seo.php?path=$1;
}
root /home/{your_domain_name}/public;
try_files $uri $uri/ /index.html;
index index.php index.html index.htm;
}
location ~ \.php$ {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
# Om nom nom cookies
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
# Custom headers and headers various browsers *should* be OK with but aren't
add_header 'Access-Control-Allow-Headers' 'X-Mx-ReqToken,Authorization,Pragma,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Accept,Origin';
# Tell client that this pre-flight info is valid for 20 days
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
set $allowcors 0;
if ($request_method = 'POST') {
set $allowcors 1;
}
if ($request_method = 'PUT') {
set $allowcors 1;
}
if ($request_method = 'GET') {
set $allowcors 1;
}
if ($request_method = 'DELETE') {
set $allowcors 1;
}
if ($allowcors = 1) {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'X-Mx-ReqToken,Authorization,Pragma,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Accept,Origin';
}
try_files $uri =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php5.6-fpm.sock;
fastcgi_param PHP_VALUE "upload_max_filesize=9G \n post_max_size=9G \n max_execution_time=200 \n max_input_time=200 \n memory_limit=256M";
}
location ~* \.(js|css|xml|less|png|jpg|jpeg|gif|pdf|doc|txt|ico|rss|zip|mp3|rar|exe|wmv|doc|avi|ppt|mpg|mpeg|tif|wav|mov|psd|ai|xls|mp4|m4a|swf|dat|dmg|iso|flv|m4v|torrent|ttf|woff|woff2|svg|eot) {
root /home/{your_domain_name}/public;
if (-f $request_filename) {
break;
}
rewrite ^/img/([a-zA-Z_]*)/([a-zA-Z_]*)/(.*)$ /server/php/image.php?size=$1&model=$2&filename=$3 last;
auth_basic off;
add_header Cache-Control public;
add_header Cache-Control must-revalidate;
expires 300d;
}
}