nginx 负载配置

来源:互联网 发布:javascript 位运算 编辑:程序博客网 时间:2024/04/26 11:31
一、下载pcre

官网下载:http://www.pcre.org/
# wget http://sourceforge.net/projects/pcre/files/pcre/8.35/pcre-8.35.tar.gz/download


二、安装zlib

# ./configure --prefix=/usr/local/zlib

# make && make install


三、安装openssl

# wget http://www.openssl.org/source/openssl-1.0.1h.tar.gz

# cd openssl-1.0.1h.tar.gz

# tar -xzvf openssl-1.0.1h.tar.gz


四、安装nginx

tar zxvf nginx-1.7.3.tar.gz

 ./configure --prefix=/usr/local/nginx  --with-pcre=../pcre-8.35 --with-http_stub_status_module --with-http_ssl_module --with-zlib=../zlib-1.2.8  --with-openssl=../openssl-1.0.1h


make

make  install

检查是否安装成功

cd  /usr/local/nginx/sbin
 ./nginx -t


重启

/usr/local/nginx/sbin/nginx -s  reload



nginx.conf

upstream miu-member-server {      
      server  172.17.190.32:4020;
      server  172.17.190.33:4020;
    }
    
    upstream miu-mobile-server {
      server  172.17.190.32:4010;
      server  172.17.190.33:4010;
    }
    
    upstream miu-wechat-server {
      server  172.17.190.34:4030;
      server  172.17.190.35:4030;
    }
    
    upstream image {
      server  172.17.190.34:4040;
      server  172.17.190.35:4040;
    }


location /miu-mobile-server/ {
            proxy_pass  http://miu-mobile-server/;
            proxy_redirect default;
        }
        
        location /miu-member-server/ {
            proxy_pass  http://miu-member-server/;
            proxy_redirect default;
        }
        
        location /miu-wechat-server/ {
            proxy_pass  http://miu-wechat-server/;
            proxy_redirect default;
        }
        
        location /image/ {
            proxy_pass  http://image/;
            proxy_redirect default;
        }
        
        location ~ /(favicon.ico|robots.txt) {
            log_not_found off;
        }



0 0
原创粉丝点击