zoukankan      html  css  js  c++  java
  • nginx 实现cache

    cache 192.168.1.142

    源192.168.1.148

    在142配置

    vi /etc/nginx/nginx.conf

    worker_processes 2;
    events {
    worker_connections 1024;
    }
    http {
    include mime.types;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;

    proxy_cache_path /data/webcache levels=1:2 keys_zone=servers:20m max_size=1g;
    server {
    listen 80;
    server_name _;
    index index.html;
    add_header X-Via $server_addr;
    add_header X-Cache $upstream_cache_status;

    location / {
    proxy_pass http://192.168.1.148:80;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_cache servers;
    proxy_cache_valid 200 5m;
    }
    }

    }

    mkdir -p /data/webcache

    chown www:www /data/ -R -f

    chcon -R -t httpd_sys_rw_content_t /data/webcache/

    systemctl restart nginx.service

    访问192.168.1.142 测试

    看/data/webserver中

  • 相关阅读:
    植物:柏树
    植物:水杉
    植物:珙桐
    植物:桫椤
    汉语-成语:悠闲自在
    植物:孑遗植物
    汉语-词语:孑遗
    汉语-词语:调味品
    调味品:酱油
    netstat 命令详解
  • 原文地址:https://www.cnblogs.com/han1094/p/6383243.html
Copyright © 2011-2022 走看看