0
点赞
收藏
分享

微信扫一扫

nginx-stream端口转发


文章目录

  • ​​stream端口转发​​
  • ​​1.问题描述​​
  • ​​2.原因及解决​​

stream端口转发

1.问题描述

[!DANGER]

在完成端口转发配置时,出现了​​nginx unknown directive "stream"​​错误,配置如下:

stream {   
upstream redis {
server 127.0.0.1:6379 max_fails=3 fail_timeout=30s;
}
server {
listen 16379;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass redis;
}

2.原因及解决

[!TIP]

nginx默认安装的时候没有加载stream模块,需要重新对源文件进行编译、安装,通过添加​​--with-stream​​​参数指定安装​​stream​​​模块1.编译检查​​./configure --with-stream​​​2.编译安装​​make & make install​​​,​​nginx -t​​​检查配置文件是否正确,​​nginx -c​​指定启动的配置文件。


举报

相关推荐

0 条评论