• nginx_cdn配置


     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=cache_one:500m inactive=10d max_size=1024m;
     8 
     9         limit_conn_zone $binary_remote_addr zone=addr:20m;
    10         limit_req_zone $binary_remote_addr zone=req_addr:20m rate=200r/s;
    11 
    12 server{
    13         listen                          80 ;
    14         server_name                     www.iquduo.com;
    15         access_log                      logs/e.cn.access.log main;
    16         error_log                       logs/e.cn.error.log;
    17 
    18         location ~* .(aac|mp3|mp4|jpeg|jpg|png|gif|js|htm|html|css|avi|mpg|rar|wmv|doc|docx|mov|flv|pdf|edb|ppt|pptx)$ {
    19                 root                    /data/nginx/cache;
    20                 proxy_cache_use_stale   error timeout http_500 http_502 http_503 http_504;
    21                 proxy_cache             cache_one;
    22                 proxy_cache_valid       200 206 304 12h;
    23                 proxy_cache_revalidate  on;
    24 
    25                 add_header              X-Cache $upstream_cache_status;
    26                 add_header              Via     "CDN";
    27                 #limit_rate_after       4096k;
    28                 #limit_rate             2048k;
    29                 #limit_req              zone=req_addr burst=300 nodelay;
    30                 #limit_req_status       503;
    31 
    32                 #proxy_limit_rate       256000; #64000 = 1Mb per connections
     1 proxy_cache_key         $scheme$proxy_host$uri;
     2                 proxy_cache_lock        on;
     3                 proxy_cache_lock_timeout 10s;
     4                 proxy_set_header        Host $host;
     5                 proxy_set_header        X-Real-IP $remote_addr;
     6                 proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
     7                 proxy_pass              http://backend;
     8                 proxy_http_version      1.1;
     9                 proxy_set_header        Connection "";
    10                 }
    11 
    12         location ~ / {
    13                 proxy_set_header        Host $host;
    14                 proxy_set_header        X-Real-IP $remote_addr;
    15                 proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    16                 proxy_pass              http://backend;
    17                 proxy_http_version      1.1;
    18                 proxy_set_header        Connection "";
    19                 }
    20 }
  • 相关阅读:
    java List转换为字符串并加入分隔符的一些方法总结
    jackson 实体转json 为NULL或者为空不参加序列化
    马云告别演讲
    Linux chmod命令
    Linux执行shell脚本的方法
    2019第36周日
    2019第36周六
    eclipse中的maven插件
    SpringBoot要点之使用Actuator监控
    eclipse隐藏的列编辑
  • 原文地址:https://www.cnblogs.com/weibiao/p/6273775.html
Copyright © 2020-2023  润新知