Nginx:作为cdn缓存时,follow 302
来源:互联网 发布:jquery json转字符串 编辑:程序博客网 时间:2024/05/20 09:06
一、说明
1.1 rewrite
www.guowenyan.cn/test.html(任意url)
rewrite
www.guowenyan.cn/test01.html
1.2 302
www.guowenyan.cn/test01.html
302
www.guowenyan.cn/test.html
二、配置nginx.conf
#user nobody;worker_processes 1;events { worker_connections 1024;}http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; sendfile on; keepalive_timeout 65; #dns resolver resolver 192.168.175.2:53 valid=1; server { listen 80; server_name localhost; #set proxy_intercept_errors on; recursive_error_pages on; #follow 302 #step 1, rewrite "any url" to "/test01.html" location / { rewrite_by_lua ' ngx.exec("/test01.html") '; } #step 2, request "/test01.html", get 302 "/test.html" location ~ /test01.html { proxy_pass http://$host; error_page 302 = @error_page_302; } #step 3, follow 302, rewrite "/test.html" location @error_page_302 { rewrite_by_lua ' local _, _, upstream_http_location = string.find(ngx.var.upstream_http_location, "^http://(.*)$") ngx.exec("/302-location/" .. upstream_http_location) '; } #step 4, request "/test.html" location ~ /302-location/([^/]+)/(.*) { proxy_pass http://$1/$2; } }}
三、测试
3.1 用了follow 302
3.2 没用follow 302
0 0
- Nginx:作为cdn缓存时,follow 302
- Nginx:设置Nginx作为缓存
- cdn缓存
- CDN缓存
- CDN缓存
- CDN缓存服务器现状,squid、nginx、trafficserver、ATS性能测试
- Nginx:作为缓存,支持Range回源
- 案例:Nginx作为Web缓存服务器应用
- Nginx作为web前端缓存和反向代理
- 将nginx同时作为负载均衡和Web缓存服务器
- CDN缓存策略FAQ
- CDN缓存原理、策略
- CDN缓存那些事
- CDN缓存那些事
- CDN缓存那些事
- 浏览器与cdn缓存
- CDN缓存那些事
- CDN缓存那些事
- php常用Output和ptions/Info函数集介绍
- 错误 finished with non-zero exit value 1
- icon图标制作
- 【FastDFS分布式文件系统之二】:FastDFS小文件上传性能测试及Python客户端上传操作
- 【零基础入门学习Python笔记001】我和Poyhon的第一次亲密接触:课后测试集答案
- Nginx:作为cdn缓存时,follow 302
- 【2015-2016 XVI Open CupC】【暴力】Constant Ratio 等差数列前若干项恰好为n
- 项目4-用循环求
- 开发板上查看U盘文件
- 第一次上机实践-项目4-循环的实际算法
- 我的IT
- 【2015-2016 XVI Open CupD】【ST-RMQ】dir -C 文件划分成最少的行
- 单片机C程序优化
- 转盘