zoukankan      html  css  js  c++  java
  • nginx添加图片处理工具

    nginx添加图片处理工具

    • 查看nginx信息 nginx -V,下载相同版本nginx解压并编译
    • configure编译时追加参数--with-http_image_filter_module,执行make命令
    • 备份原来nginx可执行文件,复制objs目录的nginx文件,到nginx sbin 目录
    • 配置 nginx.conf
    
    location ~ .*.(gif|jpg|jpeg|png)?filter$ {
      # 图片默认宽度
      set $w -;
      # 图片默认高度
      set $h -;
      if ($arg_w != "") {
        set $w $arg_w;
      }
      if ($arg_h != "") {
        set $h $arg_h;
      }
      image_filter resize  $w $h;
      image_filter crop $w $h;
      image_filter_jpeg_quality 75;
      image_filter_buffer  10M;
      try_files /$1.$2 /notfound.jpg;
      expires 30d;
      access_log off;
    }
    
    location ~* /(.+).(jpg|jpeg|gif|png)!(d+)x(d+)$ {
      set $w $3;
      set $h $4;
      image_filter resize  $w $h;
      image_filter crop $w $h;
      image_filter_jpeg_quality 75;
      image_filter_buffer  10M;
      try_files /$1.$2 /notfound.jpg;
      expires 30d;
      access_log off;
    }
    location ~ .*.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico|woff2|svg)$ {
      expires 30d;
      access_log off;
    }
    
    
  • 相关阅读:
    面试1
    初级算法-数组1
    程序员常用单词
    SpringBoot
    JDBC
    animate.css 实现 网页滚动指定位置添加动画
    解决打包上线缓存问题
    组件之间双向绑定
    按照给定数组排序原数组
    扩展运算符... 的使用
  • 原文地址:https://www.cnblogs.com/stringfade/p/15247736.html
Copyright © 2011-2022 走看看