cdn部署nginx如何配置

时间:2022-12-06 01:18

cdn部署nginx如何配置

使用nginx部署cdn的方法如下:

upstreambackend{

server1.1.1.1;

keepalive128;

}

proxy_temp_path/dev/shm;

proxy_cache_path/data/nginx/cachelevels=1:2keys_zone=cache_one:500minactive=10dmax_size=1024m;

limit_conn_zone$binary_remote_addrzone=addr:20m;

limit_req_zone$binary_remote_addrzone=req_addr:20mrate=200r/s;

server{

listen80;

server_namewww.iquduo.com;

access_loglogs/e.cn.access.logmain;

error_loglogs/e.cn.error.log;

location~*\.(aac|mp3|mp4|jpeg|jpg|png|gif|js|htm|html|css|avi|mpg|rar|wmv|doc|docx|mov|flv|pdf|edb|ppt|pptx)${

root/data/nginx/cache;

proxy_cache_use_staleerrortimeouthttp_500http_502http_503http_504;

proxy_cachecache_one;

proxy_cache_valid20020630412h;

proxy_cache_revalidateon;

add_headerX-Cache$upstream_cache_status;

add_headerVia"CDN";

#limit_rate_after4096k;

#limit_rate2048k;

#limit_reqzone=req_addrburst=300nodelay;

#limit_req_status503;

#proxy_limit_rate256000;#64000=1Mbperconnections

proxy_cache_key$scheme$proxy_host$uri;

proxy_cache_lockon;

proxy_cache_lock_timeout10s;

proxy_set_headerHost$host;

proxy_set_headerX-Real-IP$remote_addr;

proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;

proxy_passhttp://backend;

proxy_http_version1.1;

proxy_set_headerConnection"";

}

location~/{

proxy_set_headerHost$host;

proxy_set_headerX-Real-IP$remote_addr;

proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;

proxy_passhttp://backend;

proxy_http_version1.1;

proxy_set_headerConnection"";

}

}


标签:
随便看看
本类推荐
本类排行
热门标签

我国国家通讯社行不行啊细狗新年贺词祝福语2023年祝福语新年新年贺词新年贺词祝福语居家抗病毒小药箱除夕高速免费吗2022年除夕高速免费吗春联春联句子大全春联句子大全七字年夜饭十二道菜年夜饭十二道菜单年夜饭吃什么年夜饭吃什么菜吃年夜饭的寓意年夜饭黑芝麻菊花茶晒菊花茶腌腊肉送妈妈生日礼物汉白玉送闺蜜水钻送女人礼物爸爸生日送礼物送老公