O
O
okoketka2014-01-05 18:21:30
Nginx
okoketka, 2014-01-05 18:21:30

Nginx and adaptive images. How to insert code?

Hello!
How to paste the following code:

location assets {
   }
   location ai-cache {
   }
   
   location / {
       rewrite \.(?:jpe?g|gif|png)$ /adaptive-images.php;
   }

to my config file:
server {
   listen       здесь ваш IP:80;
   server_name  ваш домен.ru www.ваш домен.ru;

   location / {
       proxy_pass         http://здесь ваш IP:8080;
       proxy_redirect     http://ваш домен.ru:8080/ /;
       proxy_redirect     http://www.ваш домен.ru:8080/ /;
     

       proxy_set_header   Host             $host;
       proxy_set_header   X-Real-IP        $remote_addr;
       proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

       client_max_body_size       192m;
       client_body_buffer_size    128k;

       proxy_connect_timeout      90;
       proxy_send_timeout         900;
       proxy_read_timeout         900;

       proxy_buffer_size          64k;
       proxy_buffers              8 32k;
       proxy_busy_buffers_size    64k;
       proxy_temp_file_write_size 64k;
   }

gzip on;
       gzip_buffers 16 8k;
       gzip_comp_level 5;
       gzip_min_length 1024;
       gzip_types text/css text/plain text/json text/x-js text/javascript text/xml application/json application/x-javascript application/xml application/xml+rss application/javascript;
       gzip_disable "msie6";
       gzip_vary on;
       gzip_http_version 1.0;


   # 1

   # Static files location
   location ~* ^.+\.(jpg|jpeg|gif|swf|png|ico|mp3|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|dat|avi|ppt|txt|tar|mid|midi|wav|bmp|rtf|wmv|mpeg|mpg|mp4|m4a|spx|ogx|ogv|oga|webm|weba|ogg|tbz|js)$ {
       expires 7d;  
       root   /home/имя сервера/ваш домен.ru/docs;
       access_log  /home/имя сервера/ваш домен.ru/logs/access_log  combined;
       error_page 404 = @fallback;
       log_not_found off;
       # 1
       accel_htaccess_switch on;
   }


   location @fallback {
       proxy_pass http://здесь ваш IP:8080;

       proxy_set_header   Host             $host;
       proxy_set_header   X-Real-IP        $remote_addr;
       proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

       client_max_body_size       192m;
       client_body_buffer_size    128k;

       proxy_connect_timeout      90;
       proxy_send_timeout         900;
       proxy_read_timeout         900;

       proxy_buffer_size          64k;
       proxy_buffers              8 32k;
       proxy_busy_buffers_size    64k;
       proxy_temp_file_write_size 64k;
   }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
doriulbool, 2016-01-31
@doriulbool

I tried various options for myself, but it didn’t work out, so I’m connecting ...
My files were issued in 12 kilos ..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question