如NGiNX文档中所述,
upstream应该在
http上下文中定义。
如
nginx未知指令“
upstream”中所述:
当该文件通常由包含时
nginx.conf,它已经包含在http上下文中:
http { include /etc/nginx/sites-enabled/*;}您需要使用
-c /etc/nginx/nginx.conf或制作一个小包装,如上述代码块及其类似nginx -c内容。
如果是Docker,您可以使用
abevoelker/docker-nginx以下选项查看不同的选项:
docker run -v /tmp/foo:/foo abevoelker/nginx nginx -c /foo/nginx.conf
对于默认设置
nginx.conf,请检查以下内容
CMD:
CMD ["nginx", "-c", "/data/conf/nginx.conf"]



