nginx unknown directive “upstream”

后端 未结 3 598
一个人的身影
一个人的身影 2021-02-02 10:55

I\'m using nginx as a proxy server to forward requests onto my gunicorn server. When I run sudo nginx -t -c /etc/nginx/sites-enabled/mysite I get the following erro

3条回答
  •  Happy的楠姐
    2021-02-02 11:29

    I am using nginx version: nginx/1.4.1 on EC2 Ubuntu. I was getting this error:

    nginx: [emerg] "upstream" directive is not allowed here in /etc/nginx/nginx.conf

    To get my instance running I had to wrap the upstream and server sections in an http { } section. It then complained about missing event section. So I added that as follows:

    events { worker_connections 1024; }

    It worked fine after those fixes, this is my first effort so I was guessing my way through.

提交回复
热议问题