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;
    }
    
    
  • 相关阅读:
    Python try/except/finally
    EmailMessage类
    HTML DOM 初学笔记
    JavaScript 初学备忘录
    html style标签
    Django 导出csv文件 中文乱码问题
    Html 列表实现展开和收起
    Django CreateView 简单使用
    Django用户认证
    Nginx负载均衡配置实例详解
  • 原文地址:https://www.cnblogs.com/stringfade/p/15247736.html
Copyright © 2011-2022 走看看