server { listen 80; server_name my.chamilo.net; rewrite_log on; access_log /var/log/nginx/my.chamilo.net-access.log; error_log /var/log/nginx/my.chamilo.net-error.log notice; root /var/www/my.chamilo.net; index index.php; port_in_redirect off; location @rewrite{ try_files $uri /web/index.php; break; } location / { client_max_body_size 20M; try_files $uri $uri/ @rewrite; } location ~ \.php$ { if ($args ~ ^id_session=0) { rewrite ^courses/(.*)/(.*)$ $scheme://$host/web/courses/$1? last; } if ($args ~ ^id_session=([0-9]*)) { rewrite ^courses/(.*)/(.*)$ $scheme://$host/web/courses/$1/$args/? last; } rewrite ^courses/(.*)/index.php$ $scheme://$host/web/courses/$1? last; rewrite ^courses/(.*)/$ $scheme://$host/web/courses/$1? last; rewrite ^courses/(.*)/document/(.*)$ $scheme://$host/web/data/courses/$1/document/$2 last; rewrite ^courses/(.*)/scorm/(.*)$ $scheme://$host/web/data/courses/$1/scorm/$2 last; if ($uri ~ ^main/newscorm/scorm_api.php ) { break; } if ($uri ~ ^main/inc/ajax/chat.ajax.php ) { break; } rewrite ^/main/(.*)\.php $scheme://$host/web/main/$1.php last; client_max_body_size 20M; include /etc/nginx/fastcgi_params; expires 5m; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/my.chamilo.net$fastcgi_script_name; try_files $uri $uri/ @rewrite; } location /main/pages { try_files $uri /main/pages/index.php; } location /main/timeline { try_files $uri /main/timeline/index.php; } location /main/inc/ajax { autoindex off; } location /logs { return 410; } location ~* /temp/^[0-9a-f]+$ { allow all; } location /data { autoindex off; } location /config { return 410; } location ~* /main/install { try_files $uri /main/install/index.php; } location /main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/formulas/ { return 410; } location ~ /main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/cache/ { return 410; } }