Nginx   发布时间:2022-05-11  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了将Nginx配置为TCP负载均衡器大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_801_1@我想使用Nginx 1.9作为TCP负载均衡器.我在https://www.nginx.com/resources/admin-guide/tcp-load-balancing/中遵循了教程,但它没有用.

@H_801_1@每当我尝试启动Nginx时,我都会遇到错误:

@H_801_1@
Nginx: [emerg] unkNown directive "stream" in /opt/Nginx/Nginx.conf
@H_801_1@这是我的Nginx.conf文件:

@H_801_1@
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;
    }
}
@H_801_1@你能告诉我如何配置它吗?
最好的方法是从源代码编译Nginx以支持stream指令:@H_801_1@ @H_801_1@
./configure --prefix=/opt/Nginx --sbin-path=/usr/sbin/Nginx  --conf-path=/opt/Nginx/Nginx.conf --pid-path=/var/run/Nginx.pid --lock-path=/var/run/Nginx.lock --with-http_ssl_module --with-threads --with-stream --with-http_slice_module
make
sudo make install

大佬总结

以上是大佬教程为你收集整理的将Nginx配置为TCP负载均衡器全部内容,希望文章能够帮你解决将Nginx配置为TCP负载均衡器所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: