to be
a problem slover

nginx unknown directive stream解决办法

Table of Contents

问题描述

今天在nginx.con文件里加stream段落做tcp 22端口的反向代理

stream {
    server {
        listen  22;
        proxy_pass i.liushiming.cn:2222;
    }
}

报错

unknown directive “stream” in /etc/nginx/nginx.conf:xx

解决办法

在nginx.conf顶端插入下面这句,加载ngx_stream_module模块

load_module /usr/lib/nginx/modules/ngx_stream_module.so;

测试一下,没问题了

$ nginx -t

参考资料

unknown-directive-stream-in-etc-nginx-nginx

赞(11) 打赏
欢迎转载,注明出处:刘世明的博客 » nginx unknown directive stream解决办法

评论 2

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #1

    I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.

  2. #2

    Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me? https://accounts.binance.com/lv/register?ref=SMUBFN5I

觉得文章有用就打赏一下作者

支付宝扫一扫打赏

微信扫一扫打赏