天天看点

NGINX 图片服务器

在nginx.conf文件添加配置:

client_max_body_size 99m;

keepalive_timeout  6500;(修改上传时间)

location /csp_resources {

              #root   html;

    #index  index.html index.htm;

root html;

set $img_width2 9999;

set $img_height2 9999;

if ($request_filename ~ (.*)_([0-9]+)x([0-9]+).jpg){

set $img_width2 $2;

set $img_height2 $3;

rewrite ^(.*)_([0-9]+)x([0-9]+).jpg$ $1  break;

}

image_filter resize $img_width2 $img_height2;

image_filter_buffer 10M;

error_page   415 = /empty;

        }

        location / {

            proxy_pass http://127.0.0.1:8080;

   proxy_set_header X-Real-IP $remote_addr;

   proxy_set_header Host $host:9998;

            #root   html;

            #index  index.html index.htm;

        }