Last active
July 1, 2018 23:22
-
-
Save muresan/02a526b109bfd4d4ea8d6fb4ee193cac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# resize /var/www/server.name/pics/image.jpg?h=100&w=100 to /var/www/server.name/pics/100x100/image.jpg | |
server { | |
listen 80; | |
server_name server.name; | |
root /var/www/server.name; | |
location /media/ { | |
alias /var/www/server.name/pics/; | |
} | |
location ~ ^/resize/(?<imgpath>.*)$ { | |
alias /var/www/server.name/pics/; | |
try_files ${arg_w}x${arg_h}/$imgpath @resize; | |
} | |
location @resize { | |
proxy_pass http://127.0.0.1/image_resize/$imgpath?w=$arg_w&h=$arg_h; | |
proxy_store /var/www/server.name/pics/${arg_w}x${arg_h}/$imgpath; | |
proxy_store_access user:rw group:rw all:r; | |
proxy_set_header Host $host; | |
} | |
location /image_resize/ { | |
alias /var/www/server.name/pics/; | |
image_filter resize $arg_w $arg_h; | |
image_filter_jpeg_quality 90; | |
allow 127.0.0.0/8; | |
deny all; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment