nginx编译安装

11 篇文章 1 订阅
10 篇文章 1 订阅

在服务器快速集群环境搭建中,都迫切需要一个能拿来即用的负载均衡器,nginx在1.9版本之前,只支持http协议web服务器的负载均衡,从1.9版本开始以后,nginx开始支持tcp的长连接负载均衡,但是nginx默认并没有编译tcp负载均衡模块,编写它时,需要加入–with-stream参数来激活这个模块。

nginx编译加入–with-stream参数激活tcp负载均衡模块

nginx编译安装需要先安装pcre、openssl、zlib等库,也可以直接编译执行下面的configure命令,根据错误提示信息,安装相应缺少的库。

下面的make命令会向系统路径拷贝文件,需要在root用户下执行

[root@localhost nginx-1.18.0]# ./configure --with-cc=/apps/sylar/bin/gcc --with-stream
checking for OS
 + Linux 3.10.0-1160.el7.x86_64 x86_64
checking for C compiler ... found
 + using GNU C compiler
 + gcc version: 9.1.0 (GCC) 
[root@localhost nginx-1.18.0]# make && make install

编译完成后,默认安装在了/usr/local/nginx目录。

[root@localhost sbin]# cd /usr/local/nginx/
[root@localhost nginx]# ls
client_body_temp  fastcgi_temp  logs        sbin       uwsgi_temp
conf              html          proxy_temp  scgi_temp

错误1:./configure: error: C compiler cc is not found

很明显在编译过程中没有发现 C 语言编译器(checking for C compiler ... not found)

[root@localhost nginx-1.18.0]# ./configure --with-stream
checking for OS
 + Linux 3.10.0-1160.el7.x86_64 x86_64
checking for C compiler ... not found

./configure: error: C compiler cc is not found


只需要在编译选项中指定C编译器即可:--with-cc=/apps/sylar/bin/gcc

./configure --with-cc=/apps/sylar/bin/gcc --with-stream
checking for OS
 + Linux 3.10.0-1160.el7.x86_64 x86_64
checking for C compiler ... found
 + using GNU C compiler
 + gcc version: 9.1.0 (GCC) 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值