nginx报错./configure: error: C compiler cc is not found make: *** No rule to make target `build‘

安装nginx的stream模块

stream用于实现TCP和UDP转发,实现端口透传

#解压安装包
tar -zxf nginx-1.24.0.tar.gz
cd nginx-1.24.0
#安装stream模块
./configure --prefix=/usr/local/nginx --with-stream --with-stream=dynamic --with-stream_ssl_module --with-stream_realip_module
#如果安装过程遇到报错
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

make: *** No rule to make target `build', needed by `default'.  Stop.

#需要安装依赖
yum -y install make zlib-devel gcc-c++ libtool openssl openssl-devel
#然后再次安装
./configure --prefix=/usr/local/nginx --with-stream --with-stream=dynamic --with-stream_ssl_module --with-stream_realip_module
#编译安装
make && make install
#编译完成后查看安装模块
/usr/local/nginx/sbin/nginx -V
#出现以下内容表示安装完成
nginx version: nginx/1.24.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-stream --with-stream=dynamic --with-stream_ssl_module --with-stream_realip_module
#nginx配置文件中添加stream模块
stream {
	server {
		listen 9092;
		#将当前服务器端口9092,转发到172.24.188.141服务器的9092
		proxy_pass 172.24.188.141:9092;
	}
}
#重新加载配置文件
/usr/local/nginx/sbin/nginx -s reload
#报错
nginx: [emerg] unknown directive "stream" in /usr/local/nginx/conf/nginx.conf:27
#需要在nginx配置文件的第一行添加引入stream模块
load_module /usr/local/nginx/modules/ngx_stream_module.so;
#再次重新加载配置文件,没有报错,安装完成
/usr/local/nginx/sbin/nginx -s reload
  • 6
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值