scherepanov

imgproxy

Jul 5th, 2023
1,135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.88 KB | None | 0 0
  1. server {
  2.     listen 80;
  3.     server_name {{ imgproxy_host }};
  4.     location / {
  5.         expires 365d;
  6.  
  7.         set $width "0";
  8.         set $height "0";
  9.         set $type "auto";
  10.         set $enlarge "1";
  11.         set $extend "0";
  12.  
  13.         if ($arg_width) {
  14.             set $width $arg_width;
  15.         }
  16.  
  17.         if ($arg_height) {
  18.             set $height $arg_height;
  19.         }
  20.  
  21.         if ($arg_fit = "bounds") {
  22.             set $type "fit";
  23.             set $extend "1";
  24.         }
  25.  
  26.         if ($arg_fit = "crop") {
  27.             set $type "fill";
  28.             set $extend "1";
  29.         }
  30.  
  31.         set $args '';
  32.  
  33.         rewrite  ^/(.*)$   /insecure/resize:$type:$width:$height:$enlarge:$extend/bg:255:255:255/plain/local:///$1 break;
  34.  
  35.         proxy_pass         http://127.0.0.1:8001;
  36.         proxy_redirect     off;
  37.         proxy_set_header   Host $host;
  38.     }
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment