-
-
Save heynemann/3341234 to your computer and use it in GitHub Desktop.
upstream thumborbe { | |
server thumbor.myhost.com:8090 ; | |
server thumbor.myhost.com:8091 ; | |
server thumbor.myhost.com:8092 ; | |
server thumbor.myhost.com:8093 ; | |
server thumbor.myhost.com:8094 ; | |
server thumbor.myhost.com:8095 ; | |
} | |
location ~* "^/.{28}/.*(jpg|jpeg|gif|png)(#.*)?$" { | |
root /path/to/your/thumbor/generated/images; | |
expires 1M; | |
error_page 404 = @fetch; | |
} | |
location @fetch { | |
internal; | |
proxy_pass http://thumborbe$request_uri; | |
} | |
@heynemann thanks a lot, yes i somehow erased my thumbor's heroku buildpack accidentally when trying to install an nginx buildpack. (start-nginx a script provided by nginx buildpack : https://github.com/ryandotsmith/nginx-buildpack )
@heynemann I have few concerns with method suggested to scale thumbor. They might sound naive but it will be great if someone can clearify or suggest better way.
Since we are pre-deciding the number of processes, how exactly we handle case where not so many process is required? Do we kill the processes and restart them on demand?
And If we get even exceeding requests, shouldn't there should be some way start new process dynamically? (as WSGI does with threads.)
@heynemann This is a great conf to use nginx as the web server who serves the images directly if they are already created. But there is a problem, since for each image thumbor create a new folder, e.g.
Image to be served: /o8cKe6jiyqpLjcKN2Osg2da-1Es=/fit-in/640x480/image.jpg
folder created: /o8/ck/o8cKe6jiyqpLjcKN2Osg2da-1Es=/
How do we point nginx to this dynamic folders?
Do u know what I mean?
Thanks in advance.
I think I got the answer, just using the regular expressions of the same nginx:
location ~* "^/(..)(..)(.){24}/.*(jpg|jpeg|gif|png)(#.*)?$" {
root /path/to/your/thumbor/generated/images/$1/$2;
expires 1M;
error_page 404 = @fetch;
}
I wrote another nginx config, based on this gist, that works in the case of external urls.
Take a look on this gist: https://gist.github.com/eduherraiz/9618f2dee94d7876e735
Well it seems that you haven´t installed thumbor with python in that instance. What´s start-nginx doing?