首页 > 其他 > 详细

nginx 负载均衡 配置

时间:2016-03-08 02:22:38      阅读:191      评论:0      收藏:0      [点我收藏+]

?

?

1.下载 gz.tar

??

nginx-1.8.1.tar.gz
openssl-1.0.1c.tar.gz
pcre-8.37.tar.gz
zlib-1.2.8.tar.gz

2.安装 以上 软件

??

tar -zxvf pcre-8.37.tar.gz
cd pcre-8.37
./configure
make
make install

tar -zxvf openssl-1.0.1c.tar.gz
cd openssl-1.0.1c/
./config
make
make install

tar -zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8/
./configure
make
make install

tar xzf nginx-1.8.1.tar.gz
cd nginx-1.8.1/
./configure  --with-pcre=../pcre-8.37 --with-zlib=../zlib-1.2.8 --with-openssl=../openssl-1.0.1c
make
make install

?

注意:

configure: error: You need a C++ compiler for C++ support
正解
yum install -y gcc gcc-c++

?

测试安装成功否:

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

??显示 test is successful

?

?

启动 
cd  /usr/local/nginx/sbin
./nginx

关闭
./nginx -s stop 

重启 
./nginx -s reload

?

?

?负载均衡 配置

upstream test{
     #ip_hash;
     server 192.168.1.251;
     server 192.168.1.252;
     server 192.168.1.247;
 }
server {
    listen       80;
    server_name  helloword;
    location / {
         #反向代理的地址
         proxy_pass http://test;     
    }
}

?

?

?

?

nginx 负载均衡 配置

原文:http://knight-black-bob.iteye.com/blog/2281122

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!