如果需要在维护阶段将所有的请求打入某个网页的配置:
server {
listen 80;
server_name mz.caiqr.cn;
root /data/caiqiu/webLottery/wapBetting/develop/;
rewrite ^(.*)$ /system_repair.html break;
}
页面添加gzip进行压缩json
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.0;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
配置某个接口nginx缓存的问题
proxy_cache_path /data/nginx_cache levels=1:2 keys_zone=caiqiu_cache:10m max_size=10g inactive=60m;
#首页的 请求期次的另外开一个请求
location /cache_api_post_data_ren {
proxy_set_header Referer "";
proxy_set_header host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_cache caiqiu_cache;
proxy_cache_methods GET;
proxy_ignore_headers Cache-Control;
proxy_cache_valid any 1s;
proxy_pass http://127.0.0.1:8888/cache_api_post_data_ren;
}