Answer the question
In order to leave comments, you need to log in
How to setup nginx for django-nginx-image ?
I want to resize images when rendering a page using ngx_http_image_filter_module from nginx. The backend application works correctly and gives me a url like this:
/resize/60/-/media/images/0ca9f852-4d4c-4d22-b681-323219654d0a.jpg
location ~* ^/resize/([\d\-]+)/([\d\-]+)/(.+)$ {
alias /home/django/web/alpha/static_content/$3;
image_filter resize $1 $2;
image_filter_buffer 2M;
error_page 415 = /empty;
}
upstream vuer.org {
server localhost:12345 fail_timeout=0;
}
server {
listen 80;
server_name www.myproject.ru;
rewrite ^/(.*) http://myproject.ru$1 permanent;
}
server {
listen 80;
client_max_body_size 200m;
server_name myproject.ru;
access_log /home/django/web/alpha/logs/alpha.access.log;
keepalive_timeout 5;
root /home/django/web/alpha/static_content;
location / {
proxy_pass http://myproject.ru;
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /home/django/web/alpha/static_content/static/html;
}
location ~ ^/(static|media|css|js)/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://myproject.ru;
break;
root /home/django/web/alpha/static_content;
access_log /home/django/web/alpha/logs/nginx-static.access1_log;
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question