2
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?

More than 3 years have passed since last update.

AmazonLinux2 で nginx: [emerg] unknown directive "stream" in /etc/nginx/nginx.conf: に遭遇した時の解決方法/備忘録

Last updated at Posted at 2021-08-10

ハマったこと

Amazon Linux2 に nginx をインストールしたあと、nginx.conf に ソケットのリバースプロキシ設定のために stream{} ディレクトリブ を設定後に nginx.service を開始した際に以下のエラーに遭遇した。

nginx: [emerg] unknown directive "stream" in /etc/nginx/nginx.conf:xx

(2021/08/12加筆) 前提として、以下を実行しておく必要がありました。別のインスタンスに作り直している際に気付いたので加筆しました。

sudo amazon-linux-extras enable nginx1

これを行わないと、対処実行時に、以下のエラーに遭遇します。

パッケージ nginx-mod-stream は利用できません。
エラー: 何もしません

これを解決した時の備忘録です

 原因

ngx_stream_module.so が /usr/lib64/nginx/modules/ にない

 対処

$ sudo yum install nginx-mod-stream

...(略)...

インストール:
  nginx-mod-stream.x86_64 1:1.20.0-2.amzn2.0.3                                                                                                                       

完了しました!

$ pwd
/usr/lib64/nginx/modules
$ ls
ngx_stream_module.so

上記の対処後に、バックエンドのサーバに対して、nginx(リバースプロキシ)を介して、クライアントから疎通できること確認できました。

以下、参考サイト

nginx インストール手順(nginx公式)

Amazon Linux の手順を参照

it-swarm-ja.com のQA

以上です

2
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
2
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?