Created
February 8, 2014 22:29
-
-
Save haushinka2dx/8891297 to your computer and use it in GitHub Desktop.
nginx.conf for image-filter
This file contains 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
# 前半は省略 | |
http { | |
# この辺も省略 | |
server { | |
listen 80; | |
location / { | |
root html; | |
index index.html index.htm; | |
} | |
location ~ /atmos/uploaded/images/.*\.(jpg|png)$ { | |
if ($query_string ~ .*=.*) { | |
rewrite ^/atmos/uploaded/images/(.*\.(jpg|png))$ /atmos/uploaded/image_filter/$1 last; | |
} | |
} | |
location ~ ^/atmos/uploaded/image_filter/(.*\.(jpg|png))$ { | |
internal; | |
set $file $1; | |
set $width 150; | |
set $height 150; | |
set $quality 75; | |
if ($arg_width ~ (\d*)) { | |
set $width $1; | |
} | |
if ($arg_height ~ (\d*)) { | |
set $height $1; | |
} | |
if ($arg_quality ~ (100|[1-9][0-9]|[1-9])) { | |
set $quality $1; | |
} | |
rewrite ^ /atmos/uploaded/resize last; | |
} | |
location /atmos/uploaded/resize { | |
internal; | |
rewrite ^ /atmos/uploaded/images/$file break; | |
image_filter resize $width $height; | |
image_filter_jpeg_quality $quality; | |
#error_page 415 = @empty; | |
} | |
location /atmos/ { | |
client_max_body_size 100M; | |
proxy_pass http://localhost:9999/; | |
} | |
location /atmos-ws/ { | |
proxy_pass http://localhost:9998/; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment