Как-бы код покрасивше сделать?
den68
nginx-forum at nginx.us
Fri May 30 18:56:13 UTC 2014
Вот такой кусок конфига, но как-то тяжеловато и неоднозначно выглядит, как
облагородить?
location ~*
^/download/(.+\.(?:aac|ogg|mp3|wma|wmv|webm|avi|mpe?g|mp4|mpa|asf|rm|rmvb))$
{
internal;
root $root_download_path;
gzip off;
mp4;
mp4_buffer_size 1m;
mp4_max_buffer_size 5m;
rewrite ^/download/(.*)$ $1;
proxy_hide_header X-Accel-Redirect;
add_header ETag $upstream_http_etag;
add_header 'Access-Control-Allow-Origin' '*.pick-nik.ru';
add_header 'Access-Control-Allow-Credentials' 'true';
error_log /var/log/httpd/nginx/off;
access_log /var/log/httpd/nginx/off;
break;
}
location ~* ^/download/(.+\.(?:flv|fla|swf))$ {
internal;
root $root_download_path;
gzip off;
flv;
expires max;
rewrite ^/download/(.*)$ $1;
proxy_hide_header X-Accel-Redirect;
add_header ETag $upstream_http_etag;
add_header Cache-Control public;
add_header 'Access-Control-Allow-Origin' '*.pick-nik.ru';
add_header 'Access-Control-Allow-Credentials' 'true';
error_log /var/log/httpd/nginx/off;
access_log /var/log/httpd/nginx/off;
break;
}
location ~* ^/download/(.+\.(?:rar|zip|tar|gz|lzh|lha|xz|7z|rpm))$
{
internal;
root $root_download_path;
gzip off;
rewrite ^/download/(.*)$ $1;
expires max;
proxy_hide_header X-Accel-Redirect;
add_header ETag $upstream_http_etag;
add_header Cache-Control public;
add_header 'Access-Control-Allow-Origin' '*.pick-nik.ru';
add_header 'Access-Control-Allow-Credentials' 'true';
error_log /var/log/httpd/nginx/off;
access_log /var/log/httpd/nginx/off;
break;
}
Posted at Nginx Forum: http://forum.nginx.org/read.php?21,250508,250508#msg-250508
Подробная информация о списке рассылки nginx-ru