linux中nginx服务器负载均衡配置第三方负载策略url_hash安装步骤

一. 先下载一个url_hash包。

wget https://github.com/evanmiller/nginx_upstream_hash/archive/master.zip

解压url_hash包

unzip nginx_upstream_hash-master.zip

进入url_hash解压文件中

cd  nginx_upstream_hash-master/
vim  README.md

 查看与url_hash匹配的nginx版本

 下载nginx-0.7.62版本

wget http://nginx.org/download/nginx-0.7.62.tar.gz

tar -zxf nginx-0.7.62.tar.gz

解压nginx包后进入nginx-0.7.62

cd  nginx-0.7.62

配置规则

./configure  --prefix=/usr/local/server/nginx --with-openssl=/usr/include --with-pcre=/root/pcre-8.40 --with-http_stub_status_module --without-http_memcached_module --without-http_fastcgi_module --without-http_map_module --without-http_geo_module --without-http_autoindex_module --add-module=/root/nginx_upstream_hash-master

注意!!!

--add-module=/root/nginx_upstream_hash-master 此处的路径是你解压包后的位置,填写你自己的路径。

make 

make install 

进行编译安装

 出现上图中的--add-module=/root/nginx_upstream_hash-master 说明你安装成功

添加环境变量
vim /root/.bash_profile 添加服务器系统的环境变量
NGINX_HOME = /usr/local/nginx/sbin
PATH = $PATH : $NGINX_HOME
export PATH
source /root/.bash_profile 重载 root 用户系统的环境变量
加载完环境变量之后 , 执行 nginx , 就不需要再加文件路径了
nginx开启
nginx -s reload重启

 如上图进行配置nginx

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值