zoukankan      html  css  js  c++  java
  • nginx缓存服务

    1.代理缓存

    [root@lb01 ~]# mkdir /soft/cache

    [root@lb01 ~]# cat /etc/nginx/conf.d/blog_proxy.conf
    upstream blog {
    server 172.16.1.7:80;
    server 172.16.1.8:80;
    }
    server {
    server_name blog.oldboy.com;
    listen 80;
    return 302 https://$server_name$request_uri;

    }
    server {
    server_name blog.oldboy.com;
    listen 443;
    ssl on;
    ssl_certificate ssl_key/server.crt;
    ssl_certificate_key ssl_key/server.key;
    location /{
    proxy_pass http://blog;
    proxy_cache code_cache;
    proxy_cache_valid 200 304 12h;
    proxy_cache_valid any 10m;
    add_header Nginx-Cache "$upstream_cache_status";
    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
    include proxy_params;

    }


    }

    //在/etc/nginx/nginx.conf中增加

    proxy_cache_path /soft/cache levels=1:2 keys_zone=code_cache:10m max_size=10g inactive=60m use_temp_path=off;
    include /etc/nginx/conf.d/*.conf;

  • 相关阅读:
    Python--day72--ajax简介
    Python基础1 介绍、基本语法
    10-Python-字符编码
    09-Python-集合
    07-Python-字符串操作
    99-Python-深浅拷贝
    06-Python-字典
    05-Python-判断语句
    04-Python-元组
    03-Python-操作列表
  • 原文地址:https://www.cnblogs.com/fangdecheng/p/9846428.html
Copyright © 2011-2022 走看看