0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

nginxをロードバランサーとして使うときに unknown directive "stream"が発生する

Posted at

TL;TR

Debian系のnginxのパッケージにstreamモジュールが含まれていないことが原因

sudo apt install libnginx-mod-stream

状況

nginxをロードバランサーとして使うために、以下のような設定をnginx.confに追加した。

stream {
    upstream controller_backend {
        server 192.168.8.11:6443;
        server 192.168.8.12:6443;
        server 192.168.8.13:6443;
    }
    server {
        listen     6443;
        proxy_pass controller_backend;
    }
}

nginxを実行すると、以下のようなエラーが発生する。

sudo systemctl restart nginx
> Job for nginx.service failed because the control process exited with error code.
> See "systemctl status nginx.service" and "journalctl -xeu nginx.service" for details.

nginx.confの構文テストを実施してみると、

sudo nginx -t
> unknown directive "stream" in /etc/nginx/nginx.conf:84

と表示される。
(もし異なるエラーなら、本記事の内容が原因ではない)
streamを認識できるように、追加でパッケージを入れたら解決。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?