zoukankan      html  css  js  c++  java
  • nginx 配置维护页面 添加缓存

    如果需要在维护阶段将所有的请求打入某个网页的配置:
    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;
    }
    

      

  • 相关阅读:
    JavaScript中对事件简单的理解
    正则表达式 RE模块
    模块
    面向对象进阶
    元类详细解释
    四.面向对象和函数补充
    四.函数
    Python的基础知识:
    五层协议及tcp三次握手四次挥手
    nginx常见错误
  • 原文地址:https://www.cnblogs.com/zerohu/p/6293451.html
Copyright © 2011-2022 走看看