nginx “”proxy_pass” directive is not allowed here in xxxx”

問題

nginx -t を行うと以下のエラーが発生

# nginx -t
nginx: [emerg] "proxy_pass" directive is not allowed here in /etc/nginx/conf.d/aaaaaa.conf:128
nginx: configuration file /etc/nginx/nginx.conf test failed

原因

サーバーディレクティブでproxy_passを行っていたことが原因でした。

    if ($args ~ "lang=(.*)") {
        proxy_pass http://backend_aaaaa;
    }

location ディレクティブで使用する必要がある

location / {
    if ($args ~ "lang=(.*)") {
        proxy_pass http://backend_aaaaa;
    }
}

以上

コメント

タイトルとURLをコピーしました