摘要: 1 1、nginx.conf 2 split_clients "${remote_addr}AAA" $request_type { 3 25% "abtest"; 4 * "online"; 5 } 6 2、mobile.vipkid.com.cn.conf 7 if ($request_type = "abtest") {... 阅读全文
posted @ 2017-01-11 15:14 willianflasky 阅读(1285) 评论(0) 推荐(0) 编辑
摘要: 1 user daemon; 2 worker_processes auto; 3 error_log logs/err... 阅读全文
posted @ 2017-01-11 15:13 willianflasky 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 1 upstream backend { 2 server 1.1.1.1; 3 keepalive 128; 4 } 5 6 proxy_temp_path /dev/shm; 7 proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=ca... 阅读全文
posted @ 2017-01-11 15:10 willianflasky 阅读(2367) 评论(0) 推荐(0) 编辑
摘要: 1 limit_conn_zone $binary_remote_addr zone=addr:10m; 2 locaton /download { 3 limit_rate_after 128k; #是对每个连接限速128k,超过就限到50k. 4 limit_rate 50k; ... 阅读全文
posted @ 2017-01-11 15:06 willianflasky 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 一、HTTP字段理解 1.Expires: 该字段的http1.0时的规范,值为一个绝对时间的GMT格式的时间字符串,代表缓存资源的过期时间,在这个时点之前即命中缓存。 缺点:服务器返回的时间,可能与客户有时间差,时间差太大时可能会千万缓存混乱。 2.Cache-Control: 该字段为http1 阅读全文
posted @ 2017-01-11 15:05 willianflasky 阅读(1286) 评论(0) 推荐(0) 编辑
摘要: 1.rewrite return 301 http://example.com$request_uri; rewrite ^ http://example.com permanent; 2.try_file try_file $uri $uri/ /index.html; 测试$uri文件有没有,再测试$uri/目录有没有,再没有反回index.html. 3.长连接 proxy_http... 阅读全文
posted @ 2017-01-11 15:04 willianflasky 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 1 1.urls.py 2 url(r'^page2/',views.page2), 3 2.views.py 4 from django.core.paginator import Paginator,PageNotAnInteger,EmptyPage 5 def page2(request): 6 customer_list=models.UserType.object... 阅读全文
posted @ 2017-01-11 14:52 willianflasky 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 1 一、dumps,loads说明 2 1、json.dumps(data)#python-->json表示把python的字典转换成json标准的格式。 3 2、json.loads(data)#json-->python表示标准json转换成python字典。 4 5 import json 6 data = { 7 'name' : 'ACME', 8 ... 阅读全文
posted @ 2017-01-11 14:49 willianflasky 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 1 print(os.path.basename(__file__)) #a.py 2 print(os.path.dirname(os.path.abspath(__file__))) #/tmp 3 print(os.path.abspath(os.path.dirname(__file__))) #同上 4 print(os.path.abspa... 阅读全文
posted @ 2017-01-11 14:46 willianflasky 阅读(139) 评论(0) 推荐(0) 编辑