歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

Nginx負載均衡配合反向代理使用

Nginx負載均衡配合反向代理使用
  設置在http段:   www.2cto.com     upstream my_server_pool {
  server 192.168.10.21:80 weight=1 max_fails=2 fail_timeout=30s;
  server 192.168.10.20:80 weight=1 max_fails=2 fail_timeout=30s;
  proxy_cache_path /usr/local/nginx/proxy_temp levels=1:2 keys_zone=cache_one:500m  inactive=1d   max_size=1g;
設置在server段:   www.2cto.com  

  location /sms {
 proxy_pass http://my_server_pool;
 proxy_set_header Host $host;
 proxy_cache cache_one;
 proxy_set_header X-Forwarded-For $remote_addr;
 proxy_cache_valid 200 10m;
 proxy_cache_valid 304 1m;
 proxy_cache_valid 301 302 1h;
 proxy_cache_valid any 1m;
 proxy_cache_key $host$uri$is_args$args;  } 測試:    
Copyright © Linux教程網 All Rights Reserved