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"";

}

}


上一篇:为什么cdn能处理高并发

下一篇:如何判断cdn是否开启成功


CDN Nginx
Copyright © 2002-2019 测速网 www.inhv.cn 皖ICP备2023010105号
测速城市 测速地区 测速街道 网速测试城市 网速测试地区 网速测试街道
温馨提示:部分文章图片数据来源与网络,仅供参考!版权归原作者所有,如有侵权请联系删除!

热门搜索 城市网站建设 地区网站制作 街道网页设计 大写数字 热点城市 热点地区 热点街道 热点时间 房贷计算器