Configure Nginx to be a TCP load balancer Configure Nginx to be a TCP load balancer nginx nginx

Configure Nginx to be a TCP load balancer


The best way is compiling nginx from source to support stream directive:

./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_modulemakesudo make install


Using Homebrew on OS X, this can be done with:

brew install nginx-full --with-stream

This might ask you to first install the homebrew-nginx tap, in which case you might have to run

brew install homebrew/nginx/nginx-full --with-stream

to make sure that the tap gets installed first.