zoukankan      html  css  js  c++  java
  • nginx*初探

    1.安装nginx

    2.在nginx.conf的http区段中配置负载均衡段

    #cluser
    upstream myCluster{

    server 192.168.1.110:1300 weight=5;
    #server 192.168.1.110:8040;

    }

    #轮询负载,5/6的几率访问到192.168.1.110:1300

    3.在http区段中配置server段
    server {
           listen       80;
           server_name  192.168.1.104; #访问域名或ip

        #以下结尾的文件直接访问本地,不用代理
            location ~ .*.(gif|jpg|jpeg|png|bmp|swf|css|js)$
            {

                    root /usr/share/nginx/html;

            }

        #除以上文件外所有文件均访问代理
            location / {
                        proxy_pass              http://myCluster;#访问配置的负载,后端ip地址
                        proxy_redirect          off; //关闭后端返回的header修改

           add_header X-Cache $upstream_cache_status; // 增加缓存命中状态,使其可以在浏览器header头中看到
                         proxy_set_header       Host            $host;//修改发送到后端的header的host
                        proxy_set_header        X-Real-IP       $remote_addr; //设置真实ip
                        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
                }
     }

  • 相关阅读:
    newman
    集合自动化
    56. Merge Intervals
    55. Jump Game
    48. Rotate Image
    34. Search for a Range
    33. Search in Rotated Sorted Array
    16. 3Sum Closest
    15. 3Sum
    11. Container With Most Water
  • 原文地址:https://www.cnblogs.com/itfenqing/p/4429449.html
Copyright © 2011-2022 走看看