使用nginx部署cdn的方法如下:
upstream backend { server 1.1.1.1; keepalive 128; } proxy_temp_path /dev/shm; proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=cache_one:500m inactive=10d max_size=1024m; limit_conn_zone $binary_remote_addr zone=addr:20m; limit_req_zone $binary_remote_addr zone=req_addr:20m rate=200r/s; server{ listen 80 ; server_name www.iquduo.com; access_log logs/e.cn.access.log main; error_log logs/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_stale error timeout http_500 http_502 http_503 http_504; proxy_cache cache_one; proxy_cache_valid 200 206 304 12h; proxy_cache_revalidate on; add_header X-Cache $upstream_cache_status; add_header Via "CDN"; #limit_rate_after 4096k; #limit_rate 2048k; #limit_req zone=req_addr burst=300 nodelay; #limit_req_status 503; #proxy_limit_rate 256000; #64000 = 1Mb per connections proxy_cache_key $scheme$proxy_host$uri; proxy_cache_lock on; proxy_cache_lock_timeout 10s; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://backend; proxy_http_version 1.1; proxy_set_header Connection ""; } location ~ / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://backend; proxy_http_version 1.1; proxy_set_header Connection ""; } }
网页标题:cdn部署nginx如何配置
转载注明:http://www.shufengxianlan.com/qtweb/news17/466217.html
网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联