Skip to content

Instantly share code, notes, and snippets.

@tjunussov
Created April 22, 2016 18:28
Show Gist options
  • Save tjunussov/40e6b706140bb584162c550a276d88cf to your computer and use it in GitHub Desktop.
Save tjunussov/40e6b706140bb584162c550a276d88cf to your computer and use it in GitHub Desktop.
Nginx Configurations
try files in file system or proxy_pass it
******************************************
location /reports/ {
try_files $uri @reports;
}
location @reports {
proxy_cache raporlar_cache;
proxy_cache_key "$request_uri";
proxy_cache_lock on;
proxy_cache_bypass $cache_control;
proxy_cache_valid 1h; #any
expires 1h;
rewrite ^/reports/\!ram_(?<pckg>.*)/(?<proc>.*)$ /reports/!ram_${pckg}.${proc} break;
rewrite ^/reports/(?!ram_)(?<pckg>.*)/(?<proc>.*)\.(?<ext>.*)$ /reports/ram_${pckg}.${proc}_$ext break;
rewrite ^/reports/(?!ram_)(?<pckg>.*)/(?<proc>.*)$ /reports/ram_${pckg}.${proc} break;
rewrite ^/reports/(?<pckg>.*)/(?<proc>.*)\.(?<ext>.*)$ /reports/$pckg.${proc}_$ext break;
rewrite ^/reports/(?<pckg>.*)/(?<proc>.*)$ /reports/$pckg.$proc break;
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
send_timeout 300;
proxy_redirect off;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://localhost:7777;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment