nginx做TCP代理实现群集

nginx从版本1.9开始,既能做HTTP代理,又能做TCP代理,这就非常完美了。

配置nginx.conf。

为了简单起见,笔者故意去掉了HTTP代理配置部分,只保留了TCP代理配置部分:


#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}

stream {
upstream cxg {
server 127.0.0.1:8006;
server 127.0.0.1:8007;
}
server {
listen 8008;
proxy_pass cxg;
}
}

相关文章:

  • 2021-10-01
  • 2022-12-23
  • 2022-02-05
  • 2021-11-17
  • 2021-08-13
  • 2021-09-28
  • 2021-05-25
猜你喜欢
  • 2021-04-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案