【发布时间】:2016-01-05 15:20:09
【问题描述】:
我想使用 Nginx 1.9 作为 TCP 负载均衡器。我按照https://www.nginx.com/resources/admin-guide/tcp-load-balancing/ 中的教程进行操作,但没有成功。
每次我尝试启动 nginx 时,都会出现错误:
nginx: [emerg] unknown directive "stream" in /opt/nginx/nginx.conf
这是我的 nginx.conf 文件:
events {
worker_connections 1024;
}
http {
# blah blah blah
}
stream {
upstream backend {
server 127.0.0.1:9630;
server 127.0.0.1:9631;
}
server {
listen 2802;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass backend;
}
}
你能告诉我如何正确配置它吗?
【问题讨论】:
标签: nginx tcp load-balancing