2019-02-06
2019-02-06
"upstream" directive is not allowed here|Nginxのエラー

Nginを設定していて upstream" directive is not allowed hereというエラーが発生したので対応方法を記載します。
upstream" directive is not allowed here
基本的ですが、このエラーはNginxの設定で httpディレクティブ配下に設定する必要のあるupstreamをhttpの外に設定した為発生します。
nginx: [emerg] "upstream" directive is not allowed here
設定例
公式にある部分を抜粋して以下のような形で設定します。
http { upstream hogehoge.com{ } server { # simple load balancing listen 80; server_name hogehoge.com; access_log logs/big.server.access.log main; } }
ちなみにserverの設定をhttp街に設定しても 以下エラーが発生します。
"server" directive is not allowed here
こちらも同様にhttpディレクティブ配下に設定する必要があります。
以上になります。
あなたにお勧めの記事
前の記事
2019/02/20
次の記事
2018/09/21