nginx负载均衡配置报错

环境信息

  • EMQX 版本:4.4.3
  • 操作系统及版本:centos 8
  • 其他

问题描述

按照生产部署 | EMQX 文档配置

nginx 报错。

nginx: [emerg] unknown directive "status_zone" in /etc/nginx/nginx.conf:48
nginx: configuration file /etc/nginx/nginx.conf test failed

配置文件及日志

用的这个文档的配置

stream {
  upstream stream_backend {
      zone tcp_servers 64k;
      hash $remote_addr;
      server 192.168.0.2:1883 max_fails=2 fail_timeout=30s;
      server 192.168.0.3:1883 max_fails=2 fail_timeout=30s;
  }

  server {
      listen 8883 ssl;
      status_zone tcp_server;
      proxy_pass stream_backend;
      proxy_buffer_size 4k;
      ssl_handshake_timeout 15s;
      ssl_certificate     /etc/emqx/certs/cert.pem;
      ssl_certificate_key /etc/emqx/certs/key.pem;
  }
}