How to configure nginx cache acceleration in win

Source: Internet
Author: User

Nginx. conf
Program Code Copy code The Code is as follows: worker_processes 1;
Events {
Worker_connections 1024;
}
HTTP {
Include mime. types;
Include proxy. conf;
Default_type application/octet-stream;
Sendfile on;
Keepalive_timeout 65;
Server {
Listen 80;
SERVER_NAME localhost;
Location /{
Root HTML;
Index index.html index.htm;
}
Error_page 500 502 503 x.html;
Location =/50x.html {
Root HTML;
}
}
Proxy_cache_path/nginx/temp/existo levels = 1:2 keys_zone = existo: 10 m inactive = 5 m max_size = 2 m;
Proxy_cache_path/nginx/temp/blog levels = keys_zone = blog: 10 m inactive = 5 m max_size = 2 m;
Proxy_cache_path/nginx/temp/yafan levels = 1:2 keys_zone = yafan: 10 m inactive = 5 m max_size = 2 m;
Proxy_cache_path/nginx/temp/safe levels = keys_zone = safe: 10 m inactive = 5 m max_size = 2 m;
Proxy_cache_path/nginx/temp/atimg levels = 1:2 keys_zone = atimg: 100 m inactive = 5 m max_size = 2 m;
Proxy_cache_path/nginx/temp/zhuatu levels = 1:2 keys_zone = zhuatu: 10 m inactive = 5 m max_size = 2 m;
Server {Listen 80; SERVER_NAME existo.cn www.existo.cn;
Location /{
Proxy_pass http: // 218.28.188.230: 81;
Proxy_cache existo;
Proxy_cache_key $ URI;
Proxy_cache_valid 200 302 1 h;
Proxy_cache_valid 301 1D;
Proxy_cache_valid any 1 m;
Proxy_cache_min_uses 1;
}}
Server {Listen 80; SERVER_NAME blog.atimg.com;
Location /{
Proxy_pass http: // 218.28.188.230: 81;
Proxy_cache blog;
Proxy_cache_key $ URI;
Proxy_cache_valid 200 302 1 h;
Proxy_cache_valid 301 1D;
Proxy_cache_valid any 1 m;
Proxy_cache_min_uses 1;
}}
Server {Listen 80; SERVER_NAME yafan.atimg.com;
Location /{
Proxy_pass http: // 218.28.188.230: 81;
Proxy_cache yafan;
Proxy_cache_key $ URI;
Proxy_cache_valid 200 302 1 h;
Proxy_cache_valid 301 1D;
Proxy_cache_valid any 1 m;
Proxy_cache_min_uses 1;
}}
Server {Listen 80; SERVER_NAME safe.atimg.com;
Location /{
Proxy_pass http: // 218.28.188.230: 81;
Proxy_cache safe;
Proxy_cache_key $ URI;
Proxy_cache_valid 200 302 1 h;
Proxy_cache_valid 301 1D;
Proxy_cache_valid any 1 m;
Proxy_cache_min_uses 1;
}}
Server {Listen 80; SERVER_NAME atimg.com www.atimg.com;
Location ~ *. (HTM | HTML | shtml | SWF | PNG | JPG | GIF | JPEG | RAR | CSS | JS) $ {
Index index. php;
Proxy_pass http: // 218.28.188.230: 81;
Proxy_temp_path/nginx/temp/cache;
Proxy_cache atimg;
Proxy_cache_key $ URI;
Proxy_cache_valid 200 302 1 h;
Proxy_cache_valid 301 1D;
Proxy_cache_valid any 1 m;
Proxy_cache_min_uses 1;
}}
Server {Listen 80; SERVER_NAME zhuatu.atimg.com;
Location /{
Proxy_pass http: // 218.28.188.230: 81;
Proxy_cache zhuatu;
Proxy_cache_key $ URI;
Proxy_cache_valid 200 302 1 h;
Proxy_cache_valid 301 1D;
Proxy_cache_valid any 1 m;
Proxy_cache_min_uses 1;
}}
}

proxy. conf
program code copy Code the code is as follows: proxy_redirect off;
proxy_set_header host $ host;
proxy_set_header X-real-IP $ remote_addr;
proxy_set_header remote-host $ remote_addr;
proxy_set_header X-forwarded-for $ remote_addr;
proxy_set_header X-forwarded-for $ scheme;
client_max_body_size 10 m;
limit 128 K;
# client_body_temp_path/var/nginx/client_body_temp;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
#proxy_send_lowat 12000;
proxy_buffer_size 32 K;
proxy_buffers 4 32 K;
proxy_busy_buffers_size 64 K;
proxy_temp_file_write_size 64 K;
# proxy_temp_path/var/nginx/proxy_temp;
proxy_ignore_client_abort on;
proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
proxy_max_temp_file_size 128 M;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.